diff --git a/python/core/qgsproviderregistry.sip b/python/core/qgsproviderregistry.sip
index 4c0d9214888..78e7b246447 100644
--- a/python/core/qgsproviderregistry.sip
+++ b/python/core/qgsproviderregistry.sip
@@ -26,7 +26,7 @@ class QgsProviderRegistry
void setLibraryDirectory(const QDir & path);
- QgsDataProvider * getProvider( const QString & providerKey,
+ QgsDataProvider *provider( const QString & providerKey,
const QString & dataSource );
/** Return list of available providers by their keys */
diff --git a/scripts/astyle-all.sh b/scripts/astyle-all.sh
index e78c9b61fd4..24a1540a5c9 100755
--- a/scripts/astyle-all.sh
+++ b/scripts/astyle-all.sh
@@ -8,21 +8,21 @@ export elcr="$(tput el)$(tput cr)"
find src -type f -print | while read f; do
case "$f" in
- src/core/spatialite/*)
- continue
- ;;
+ src/core/spatialite/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
+ echo $f skipped
+ continue
+ ;;
-
- *.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H)
+ *.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.hpp)
cmd=astyle.sh
;;
- *.ui|*.qgm|*.txt|*.t2t|*.py|*.sip|resources/context_help/*)
- cmd="flip -ub"
- ;;
-
+ *.ui|*.qgm|*.txt|*.t2t|*.py|*.sip|resources/context_help/*)
+ cmd="flip -ub"
+ ;;
*)
+ echo $f skipped
continue
;;
esac
diff --git a/src/analysis/interpolation/DualEdgeTriangulation.cc b/src/analysis/interpolation/DualEdgeTriangulation.cc
index dd94cbeadb7..b9a38dfe456 100644
--- a/src/analysis/interpolation/DualEdgeTriangulation.cc
+++ b/src/analysis/interpolation/DualEdgeTriangulation.cc
@@ -1979,7 +1979,6 @@ void DualEdgeTriangulation::ruppertRefinement()
}
while ( actedge != pointingedge );
-
}
}
}
@@ -2190,9 +2189,6 @@ void DualEdgeTriangulation::ruppertRefinement()
}
while ( actedge != pointingedge );
-
-
-
}
} //end fast method
@@ -2407,7 +2403,6 @@ void DualEdgeTriangulation::ruppertRefinement()
}
while ( actedge != pointingedge );
-
}
}
diff --git a/src/analysis/interpolation/ParametricLine.h b/src/analysis/interpolation/ParametricLine.h
index eb0897fdc71..62b8721a2fa 100644
--- a/src/analysis/interpolation/ParametricLine.h
+++ b/src/analysis/interpolation/ParametricLine.h
@@ -22,7 +22,7 @@
#include
class ANALYSIS_EXPORT ParametricLine
- /**ParametricLine is an Interface for parametric lines. It is possible, that a parametric line is composed of several parametric lines (see the composite pattern in Gamma et al. 'Design Patterns'). Do not build instances of it since it is an abstract class.*/
+ /**ParametricLine is an Interface for parametric lines. It is possible, that a parametric line is composed of several parametric lines (see the composite pattern in Gamma et al. 'Design Patterns'). Do not build instances of it since it is an abstract class.*/
{
protected:
/**Degree of the parametric Line*/
diff --git a/src/app/attributetable/qgsattributetabledialog.cpp b/src/app/attributetable/qgsattributetabledialog.cpp
index 3eb7610b69a..c7d3a062c2a 100644
--- a/src/app/attributetable/qgsattributetabledialog.cpp
+++ b/src/app/attributetable/qgsattributetabledialog.cpp
@@ -137,7 +137,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
connect( mView->verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( updateRowPressed( int ) ) );
connect( mModel, SIGNAL( modelChanged() ), this, SLOT( updateSelection() ) );
- connect( mView, SIGNAL(willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT(viewWillShowContextMenu(QMenu*, QModelIndex ) ) );
+ connect( mView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) );
mLastClickedHeaderIndex = 0;
mSelectionModel = new QItemSelectionModel( mFilterModel );
diff --git a/src/app/composer/qgscomposer.cpp b/src/app/composer/qgscomposer.cpp
index 173b55e49fb..34c68a85fb5 100644
--- a/src/app/composer/qgscomposer.cpp
+++ b/src/app/composer/qgscomposer.cpp
@@ -499,7 +499,8 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
int result = myQFileDialog->exec();
raise();
- if ( result != QDialog::Accepted ) return;
+ if ( result != QDialog::Accepted )
+ return;
QString myOutputFileNameQString = myQFileDialog->selectedFiles().first();
if ( myOutputFileNameQString == "" )
@@ -666,7 +667,8 @@ void QgsComposer::on_mActionExportAsImage_triggered()
QString myFilter = tr( "%1 format (*.%2 *.%3)" )
.arg( myFormat ).arg( myFormat.toLower() ).arg( myFormat.toUpper() );
- if ( myCounterInt > 0 ) myFilters += ";;";
+ if ( myCounterInt > 0 )
+ myFilters += ";;";
myFilters += myFilter;
myFilterMap[myFilter] = myFormat;
if ( myFormat == myLastUsedFormat )
@@ -799,7 +801,8 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
int result = myQFileDialog->exec();
raise();
- if ( result != QDialog::Accepted ) return;
+ if ( result != QDialog::Accepted )
+ return;
QString myOutputFileNameQString = myQFileDialog->selectedFiles().first();
if ( myOutputFileNameQString == "" )
diff --git a/src/app/composer/qgscomposermapwidget.cpp b/src/app/composer/qgscomposermapwidget.cpp
index 139149d1ab1..cd47c59a3ec 100644
--- a/src/app/composer/qgscomposermapwidget.cpp
+++ b/src/app/composer/qgscomposermapwidget.cpp
@@ -402,13 +402,17 @@ void QgsComposerMapWidget::updateComposerExtentFromGui()
bool conversionSuccess;
xmin = mXMinLineEdit->text().toDouble( &conversionSuccess );
- if ( !conversionSuccess ) {return;}
+ if ( !conversionSuccess )
+ return;
xmax = mXMaxLineEdit->text().toDouble( &conversionSuccess );
- if ( !conversionSuccess ) {return;}
+ if ( !conversionSuccess )
+ return;
ymin = mYMinLineEdit->text().toDouble( &conversionSuccess );
- if ( !conversionSuccess ) {return;}
+ if ( !conversionSuccess )
+ return;
ymax = mYMaxLineEdit->text().toDouble( &conversionSuccess );
- if ( !conversionSuccess ) {return;}
+ if ( !conversionSuccess )
+ return;
QgsRectangle newExtent( xmin, ymin, xmax, ymax );
mComposerMap->beginCommand( tr( "Map extent changed" ) );
diff --git a/src/app/legend/qgslegend.cpp b/src/app/legend/qgslegend.cpp
index be2bb04c437..a81ea786bfd 100644
--- a/src/app/legend/qgslegend.cpp
+++ b/src/app/legend/qgslegend.cpp
@@ -870,7 +870,8 @@ void QgsLegend::legendLayerShowInOverview()
return;
QgsLegendLayer* ll = qobject_cast( li );
- if ( !ll ) return;
+ if ( !ll )
+ return;
ll->showInOverview();
}
@@ -1805,7 +1806,7 @@ void QgsLegend::legendLayerZoom()
}
}
- if( extent.isEmpty() )
+ if ( extent.isEmpty() )
{
return;
}
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 53ec83f9c89..f674b05f684 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -448,7 +448,7 @@ int main( int argc, char *argv[] )
}
// GUI customization is enabled by default unless --nocustomization argument is used
- QgsCustomization::instance()->setEnabled(myCustomization);
+ QgsCustomization::instance()->setEnabled( myCustomization );
QgsApplication myApp( argc, argv, myUseGuiFlag, configpath );
@@ -624,10 +624,10 @@ int main( int argc, char *argv[] )
QgisApp *qgis = new QgisApp( mypSplash, myRestorePlugins ); // "QgisApp" used to find canonical instance
qgis->setObjectName( "QgisApp" );
- myApp.connect (
- &myApp, SIGNAL( preNotify( QObject *, QEvent *, bool *)),
+ myApp.connect(
+ &myApp, SIGNAL( preNotify( QObject *, QEvent *, bool * ) ),
//qgis, SLOT( preNotify( QObject *, QEvent *))
- QgsCustomization::instance(), SLOT( preNotify( QObject *, QEvent *, bool *))
+ QgsCustomization::instance(), SLOT( preNotify( QObject *, QEvent *, bool * ) )
);
/////////////////////////////////////////////////////////////////////
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp
index c2c5f0a48f0..7742310b899 100644
--- a/src/app/qgisapp.cpp
+++ b/src/app/qgisapp.cpp
@@ -983,9 +983,9 @@ void QgisApp::createMenus()
// Panel and Toolbar Submenus
mPanelMenu = new QMenu( tr( "Panels" ) );
- mPanelMenu->setObjectName("mPanelMenu");
+ mPanelMenu->setObjectName( "mPanelMenu" );
mToolbarMenu = new QMenu( tr( "Toolbars" ) );
- mToolbarMenu->setObjectName("mToolbarMenu");
+ mToolbarMenu->setObjectName( "mToolbarMenu" );
// Get platform for menu layout customization (Gnome, Kde, Mac, Win)
QDialogButtonBox::ButtonLayout layout =
@@ -1079,9 +1079,9 @@ void QgisApp::createToolBars()
QList toolbarMenuActions;
// Set action names so that they can be used in customization
- foreach ( QToolBar *toolBar, toolbarMenuToolBars )
+ foreach( QToolBar *toolBar, toolbarMenuToolBars )
{
- toolBar->toggleViewAction()->setObjectName ( "mActionToggle" + toolBar->objectName().mid(1) );
+ toolBar->toggleViewAction()->setObjectName( "mActionToggle" + toolBar->objectName().mid( 1 ) );
toolbarMenuActions << toolBar->toggleViewAction();
}
@@ -2448,16 +2448,16 @@ void QgisApp::addWmsLayer()
QgsDebugMsg( "about to addRasterLayer" );
// TODO: QDialog for now, switch to QWidget in future
- QDialog *wmss = dynamic_cast ( QgsProviderRegistry::instance()->getSelectWidget( QString("wms"), this ) );
- if ( !wmss )
+ QDialog *wmss = dynamic_cast( QgsProviderRegistry::instance()->selectWidget( QString( "wms" ), this ) );
+ if ( !wmss )
{
QMessageBox::warning( this, tr( "WMS" ), tr( "Cannot get WMS select dialog from provider." ) );
- return;
+ return;
}
- connect ( wmss , SIGNAL ( addRasterLayer( QString const &, QString const &, QString const &,QStringList const &,QStringList const &,QString const &,
-QString const &) ),
- this , SLOT ( addRasterLayer( QString const &, QString const &, QString const &,QStringList const &,QStringList const &,QString const &,
-QString const &) ) );
+ connect( wmss , SIGNAL( addRasterLayer( QString const &, QString const &, QString const &, QStringList const &, QStringList const &, QString const &,
+ QString const & ) ),
+ this , SLOT( addRasterLayer( QString const &, QString const &, QString const &, QStringList const &, QStringList const &, QString const &,
+ QString const & ) ) );
wmss->exec();
delete wmss;
}
@@ -3103,8 +3103,10 @@ void QgisApp::toggleActiveWindowMaximized()
QWidget *window = QApplication::activeWindow();
if ( window )
{
- if ( window->isMaximized() ) window->showNormal();
- else window->showMaximized();
+ if ( window->isMaximized() )
+ window->showNormal();
+ else
+ window->showMaximized();
}
}
@@ -4554,8 +4556,8 @@ void QgisApp::showPluginManager()
// implementation of the python runner
class QgsPythonRunnerImpl : public QgsPythonRunner
{
-public:
- QgsPythonRunnerImpl(QgsPythonUtils* pythonUtils) : mPythonUtils(pythonUtils) {}
+ public:
+ QgsPythonRunnerImpl( QgsPythonUtils* pythonUtils ) : mPythonUtils( pythonUtils ) {}
virtual bool runCommand( QString command, QString messageOnError = QString() )
{
if ( mPythonUtils && mPythonUtils->isEnabled() )
@@ -4565,7 +4567,7 @@ public:
return false;
}
-protected:
+ protected:
QgsPythonUtils* mPythonUtils;
};
@@ -4615,7 +4617,7 @@ void QgisApp::loadPythonSupport()
QgsPluginRegistry::instance()->setPythonUtils( mPythonUtils );
// init python runner
- QgsPythonRunner::setInstance( new QgsPythonRunnerImpl(mPythonUtils) );
+ QgsPythonRunner::setInstance( new QgsPythonRunnerImpl( mPythonUtils ) );
std::cout << "Python support ENABLED :-) " << std::endl; // OK
}
@@ -5477,7 +5479,8 @@ void QgisApp::updateMouseCoordinatePrecision()
dp = QgsProject::instance()->readNumEntry( "PositionPrecision", "/DecimalPlaces" );
// Keep dp sensible
- if ( dp < 0 ) dp = 0;
+ if ( dp < 0 )
+ dp = 0;
mMousePrecisionDecimalPlaces = dp;
}
diff --git a/src/app/qgsabout.cpp b/src/app/qgsabout.cpp
index b2c322c5d1e..eec83bf25f8 100644
--- a/src/app/qgsabout.cpp
+++ b/src/app/qgsabout.cpp
@@ -71,7 +71,8 @@ void QgsAbout::init()
{
line = stream.readLine(); // line of text excluding '\n'
//ignore the line if it starts with a hash....
- if ( line.left( 1 ) == "#" ) continue;
+ if ( line.left( 1 ) == "#" )
+ continue;
QStringList myTokens = line.split( "\t", QString::SkipEmptyParts );
lines << myTokens[0];
}
@@ -102,7 +103,8 @@ void QgsAbout::init()
{
line = stream.readLine(); // line of text excluding '\n'
//ignore the line if it starts with a hash....
- if ( line.left( 1 ) == "#" ) continue;
+ if ( line.left( 1 ) == "#" )
+ continue;
lines += line;
}
file2.close();
@@ -129,7 +131,8 @@ void QgsAbout::init()
"money to fund QGIS development and other project costs see "
""
"http://qgis.org/en/sponsorship/donors.html
" );
- /*QString website;
+#if 0
+ QString website;
QTextStream donorsStream( &donorsFile );
// Always use UTF-8
donorsStream.setCodec( "UTF-8" );
@@ -138,7 +141,8 @@ void QgsAbout::init()
{
sline = donorsStream.readLine(); // line of text excluding '\n'
//ignore the line if it starts with a hash....
- if ( sline.left( 1 ) == "#" ) continue;
+ if ( sline.left( 1 ) == "#" )
+ continue;
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
if ( myTokens.size() > 1 )
{
@@ -153,7 +157,8 @@ void QgsAbout::init()
// close the row
donorsHTML += "";
}
- donorsHTML += "";*/
+ donorsHTML += "";
+#endif
QString myStyle = QgsApplication::reportStyleSheet();
txtDonors->clear();
@@ -187,7 +192,8 @@ void QgsAbout::init()
{
sline = translatorStream.readLine(); // line of text excluding '\n'
//ignore the line if it starts with a hash....
- if ( sline.left( 1 ) == "#" ) continue;
+ if ( sline.left( 1 ) == "#" )
+ continue;
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
if ( myTokens.size() > 1 )
{
diff --git a/src/app/qgsattributeactiondialog.cpp b/src/app/qgsattributeactiondialog.cpp
index daddcdc1edf..36d6a7a3da7 100644
--- a/src/app/qgsattributeactiondialog.cpp
+++ b/src/app/qgsattributeactiondialog.cpp
@@ -164,7 +164,8 @@ void QgsAttributeActionDialog::remove()
attributeActionTable->removeRow( row );
// And select the row below the one that was selected or the last one.
- if ( row >= attributeActionTable->rowCount() ) row = attributeActionTable->rowCount() - 1;
+ if ( row >= attributeActionTable->rowCount() )
+ row = attributeActionTable->rowCount() - 1;
attributeActionTable->selectRow( row );
}
}
@@ -172,7 +173,6 @@ void QgsAttributeActionDialog::remove()
void QgsAttributeActionDialog::insert()
{
// Add the action details as a new row in the table.
-
int pos = attributeActionTable->rowCount();
insert( pos );
}
diff --git a/src/app/qgsconfigureshortcutsdialog.cpp b/src/app/qgsconfigureshortcutsdialog.cpp
index 00a31ba5b04..f168719705e 100644
--- a/src/app/qgsconfigureshortcutsdialog.cpp
+++ b/src/app/qgsconfigureshortcutsdialog.cpp
@@ -212,7 +212,8 @@ void QgsConfigureShortcutsDialog::changeShortcut()
void QgsConfigureShortcutsDialog::resetShortcut()
{
QAction* action = currentAction();
- if ( !action ) return;
+ if ( !action )
+ return;
// set default shortcut
QString shortcut = QgsShortcutsManager::instance()->actionDefaultShortcut( action );
@@ -361,7 +362,8 @@ void QgsConfigureShortcutsDialog::setGettingShortcut( bool getting )
void QgsConfigureShortcutsDialog::setCurrentActionShortcut( QKeySequence s )
{
QAction* action = currentAction();
- if ( !action ) return;
+ if ( !action )
+ return;
// first check whether this action is not taken already
QAction* otherAction = QgsShortcutsManager::instance()->actionForShortcut( s );
diff --git a/src/app/qgscustomization.cpp b/src/app/qgscustomization.cpp
index db70fe00960..59839860fef 100644
--- a/src/app/qgscustomization.cpp
+++ b/src/app/qgscustomization.cpp
@@ -35,28 +35,25 @@
#include
#include
#include
-
-//standard includes
-#include
-#include
-#include
+#include
#ifdef Q_OS_MACX
QgsCustomizationDialog::QgsCustomizationDialog()
- : QMainWindow( NULL, Qt::WindowSystemMenuHint ), // Modeless dialog with close button only
- mSettings ( "QuantumGIS", "QGISCUSTOMIZATION" )
+ : QMainWindow( NULL, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
+ , mSettings( "QuantumGIS", "QGISCUSTOMIZATION" )
#else
QgsCustomizationDialog::QgsCustomizationDialog()
- : QMainWindow( NULL ), mSettings ( "QuantumGIS", "QGISCUSTOMIZATION" )
+ : QMainWindow( NULL )
+ , mSettings( "QuantumGIS", "QGISCUSTOMIZATION" )
#endif
{
setupUi( this );
init();
QStringList myHeaders;
- myHeaders << tr("Object name") << tr("Label") << tr("Description");
- treeWidget->setHeaderLabels ( myHeaders );
-
- mLastDirSettingsName = QString("/UI/lastCustomizationDir" );
+ myHeaders << tr( "Object name" ) << tr( "Label" ) << tr( "Description" );
+ treeWidget->setHeaderLabels( myHeaders );
+
+ mLastDirSettingsName = QString( "/UI/lastCustomizationDir" );
//treeWidget->hideColumn(0)
connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( ok() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
@@ -69,76 +66,81 @@ QgsCustomizationDialog::~QgsCustomizationDialog()
{
}
-QTreeWidgetItem * QgsCustomizationDialog::item ( QString thePath, QTreeWidgetItem *theItem )
+QTreeWidgetItem * QgsCustomizationDialog::item( QString thePath, QTreeWidgetItem *theItem )
{
QString path = thePath;
- if ( path.startsWith("/") ) path = path.mid(1); // remove '/'
- QStringList names = path.split('/');
- path = QStringList(names.mid(1)).join ("/" );
+ if ( path.startsWith( "/" ) )
+ path = path.mid( 1 ); // remove '/'
+ QStringList names = path.split( '/' );
+ path = QStringList( names.mid( 1 ) ).join( "/" );
- if ( ! theItem )
+ if ( ! theItem )
{
- for (int i = 0; i < treeWidget->topLevelItemCount(); ++i)
+ for ( int i = 0; i < treeWidget->topLevelItemCount(); ++i )
{
- QTreeWidgetItem *myItem = treeWidget->topLevelItem(i);
- QString objectName = myItem->text(0);
- if ( objectName == names[0] )
+ QTreeWidgetItem *myItem = treeWidget->topLevelItem( i );
+ QString objectName = myItem->text( 0 );
+ if ( objectName == names[0] )
{
- return item ( path, myItem );
+ return item( path, myItem );
}
}
}
else
{
- for (int i = 0; i < theItem->childCount(); ++i) {
- QTreeWidgetItem *myItem = theItem->child(i);
- QString objectName = myItem->text(0);
- if ( objectName == names[0] )
+ for ( int i = 0; i < theItem->childCount(); ++i )
+ {
+ QTreeWidgetItem *myItem = theItem->child( i );
+ QString objectName = myItem->text( 0 );
+ if ( objectName == names[0] )
{
- if ( names.size () == 1 )
+ if ( names.size() == 1 )
{
- return myItem;
+ return myItem;
}
else
{
- return item ( path, myItem );
+ return item( path, myItem );
}
}
}
}
- QgsDebugMsg( "not found") ;
+ QgsDebugMsg( "not found" ) ;
return 0;
}
-bool QgsCustomizationDialog::itemChecked ( QString thePath )
+bool QgsCustomizationDialog::itemChecked( QString thePath )
{
- QgsDebugMsg( QString("thePath = %1").arg(thePath));
- QTreeWidgetItem *myItem = item ( thePath );
- if ( !myItem ) return true;
- return myItem->checkState(0) == Qt::Checked ? true : false;
+ QgsDebugMsg( QString( "thePath = %1" ).arg( thePath ) );
+ QTreeWidgetItem *myItem = item( thePath );
+ if ( !myItem )
+ return true;
+ return myItem->checkState( 0 ) == Qt::Checked ? true : false;
}
-void QgsCustomizationDialog::setItemChecked ( QString thePath, bool on )
+void QgsCustomizationDialog::setItemChecked( QString thePath, bool on )
{
- QgsDebugMsg( QString("thePath = %1 on = %2").arg(thePath).arg(on));
- QTreeWidgetItem *myItem = item ( thePath );
- if ( !myItem ) return;
- myItem->setCheckState(0, on ? Qt::Checked : Qt::Unchecked);
+ QgsDebugMsg( QString( "thePath = %1 on = %2" ).arg( thePath ).arg( on ) );
+ QTreeWidgetItem *myItem = item( thePath );
+ if ( !myItem )
+ return;
+ myItem->setCheckState( 0, on ? Qt::Checked : Qt::Unchecked );
}
void QgsCustomizationDialog::settingsToItem( QString thePath, QTreeWidgetItem *theItem, QSettings *theSettings )
{
- QString objectName = theItem->text(0);
- if (objectName.isEmpty())
+ QString objectName = theItem->text( 0 );
+ if ( objectName.isEmpty() )
return; // object is not identifiable
QString myPath = thePath + "/" + objectName;
- bool on = theSettings->value(myPath, true).toBool();
- theItem->setCheckState(0, on ? Qt::Checked : Qt::Unchecked );
+ bool on = theSettings->value( myPath, true ).toBool();
+ theItem->setCheckState( 0, on ? Qt::Checked : Qt::Unchecked );
- for (int i = 0; i < theItem->childCount(); ++i) {
- QTreeWidgetItem *myItem = theItem->child(i);
+ for ( int i = 0; i < theItem->childCount(); ++i )
+ {
+ QTreeWidgetItem *myItem = theItem->child( i );
settingsToItem( myPath, myItem, theSettings );
}
}
@@ -146,39 +148,41 @@ void QgsCustomizationDialog::settingsToItem( QString thePath, QTreeWidgetItem *t
void QgsCustomizationDialog::itemToSettings( QString thePath, QTreeWidgetItem *theItem, QSettings *theSettings )
{
- QString objectName = theItem->text(0);
- if (objectName.isEmpty())
+ QString objectName = theItem->text( 0 );
+ if ( objectName.isEmpty() )
return; // object is not identifiable
QString myPath = thePath + "/" + objectName;
- bool on = theItem->checkState(0) == Qt::Checked ? true : false;
+ bool on = theItem->checkState( 0 ) == Qt::Checked ? true : false;
theSettings->setValue( myPath, on );
- for (int i = 0; i < theItem->childCount(); ++i) {
- QTreeWidgetItem *myItem = theItem->child(i);
+ for ( int i = 0; i < theItem->childCount(); ++i )
+ {
+ QTreeWidgetItem *myItem = theItem->child( i );
itemToSettings( myPath, myItem, theSettings );
}
}
-void QgsCustomizationDialog::treeToSettings ( QSettings *theSettings )
+void QgsCustomizationDialog::treeToSettings( QSettings *theSettings )
{
- for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) {
- itemToSettings( QString("/Customization"), treeWidget->topLevelItem(i), theSettings );
+ for ( int i = 0; i < treeWidget->topLevelItemCount(); ++i )
+ {
+ itemToSettings( QString( "/Customization" ), treeWidget->topLevelItem( i ), theSettings );
}
}
-void QgsCustomizationDialog::settingsToTree ( QSettings *theSettings )
+void QgsCustomizationDialog::settingsToTree( QSettings *theSettings )
{
- for (int i = 0; i < treeWidget->topLevelItemCount(); ++i)
+ for ( int i = 0; i < treeWidget->topLevelItemCount(); ++i )
{
- settingsToItem( QString("/Customization"), treeWidget->topLevelItem(i), theSettings );
+ settingsToItem( QString( "/Customization" ), treeWidget->topLevelItem( i ), theSettings );
}
}
void QgsCustomizationDialog::reset()
{
mSettings.sync();
- settingsToTree ( &mSettings );
+ settingsToTree( &mSettings );
}
void QgsCustomizationDialog::ok()
@@ -188,9 +192,9 @@ void QgsCustomizationDialog::ok()
}
void QgsCustomizationDialog::apply()
{
- QgsDebugMsg( QString("columnCount = %1").arg( treeWidget->columnCount() ) );
- treeToSettings ( &mSettings );
- mSettings.setValue( QgsCustomization::instance()->statusPath(), QgsCustomization::User);
+ QgsDebugMsg( QString( "columnCount = %1" ).arg( treeWidget->columnCount() ) );
+ treeToSettings( &mSettings );
+ mSettings.setValue( QgsCustomization::instance()->statusPath(), QgsCustomization::User );
mSettings.sync();
}
@@ -204,16 +208,17 @@ void QgsCustomizationDialog::on_actionSave_triggered( bool checked )
QSettings mySettings;
QString lastDir = mySettings.value( mLastDirSettingsName, "." ).toString();
- QString fileName = QFileDialog::getSaveFileName(this,
- tr( "Choose a customization INI file" ),
- lastDir, tr( "Customization files (*.ini)" ) );
+ QString fileName = QFileDialog::getSaveFileName( this,
+ tr( "Choose a customization INI file" ),
+ lastDir, tr( "Customization files (*.ini)" ) );
- if ( fileName.isEmpty() ) return;
+ if ( fileName.isEmpty() )
+ return;
QFileInfo fileInfo( fileName );
- mySettings.setValue ( mLastDirSettingsName, fileInfo.absoluteDir().absolutePath () );
+ mySettings.setValue( mLastDirSettingsName, fileInfo.absoluteDir().absolutePath() );
- QSettings fileSettings( fileName, QSettings::IniFormat);
- treeToSettings ( &fileSettings );
+ QSettings fileSettings( fileName, QSettings::IniFormat );
+ treeToSettings( &fileSettings );
}
void QgsCustomizationDialog::on_actionLoad_triggered( bool checked )
@@ -221,16 +226,17 @@ void QgsCustomizationDialog::on_actionLoad_triggered( bool checked )
QSettings mySettings;
QString lastDir = mySettings.value( mLastDirSettingsName, "." ).toString();
- QString fileName = QFileDialog::getOpenFileName(this,
- tr( "Choose a customization INI file" ),
- lastDir, tr( "Customization files (*.ini)" ) );
+ QString fileName = QFileDialog::getOpenFileName( this,
+ tr( "Choose a customization INI file" ),
+ lastDir, tr( "Customization files (*.ini)" ) );
- if ( fileName.isEmpty() ) return;
+ if ( fileName.isEmpty() )
+ return;
QFileInfo fileInfo( fileName );
- mySettings.setValue ( mLastDirSettingsName, fileInfo.absoluteDir().absolutePath () );
-
- QSettings fileSettings( fileName, QSettings::IniFormat);
- settingsToTree ( &fileSettings );
+ mySettings.setValue( mLastDirSettingsName, fileInfo.absoluteDir().absolutePath() );
+
+ QSettings fileSettings( fileName, QSettings::IniFormat );
+ settingsToTree( &fileSettings );
}
void QgsCustomizationDialog::on_actionExpandAll_triggered( bool checked )
@@ -245,12 +251,12 @@ void QgsCustomizationDialog::on_actionCollapseAll_triggered( bool checked )
void QgsCustomizationDialog::on_actionSelectAll_triggered( bool checked )
{
- QList items = treeWidget->findItems("*",Qt::MatchWildcard|Qt::MatchRecursive, 0);
-
+ QList items = treeWidget->findItems( "*", Qt::MatchWildcard | Qt::MatchRecursive, 0 );
+
QList::iterator i;
- for ( i = items.begin(); i != items.end(); ++i)
+ for ( i = items.begin(); i != items.end(); ++i )
{
- (*i)->setCheckState(0, Qt::Checked);
+ ( *i )->setCheckState( 0, Qt::Checked );
}
}
@@ -258,21 +264,22 @@ void QgsCustomizationDialog::init()
{
QgsDebugMsg( "Entered" );
QTreeWidgetItem * wi = createTreeItemWidgets();
- if ( wi ) {
- treeWidget->insertTopLevelItem(0, wi );
+ if ( wi )
+ {
+ treeWidget->insertTopLevelItem( 0, wi );
treeWidget->expandItem( wi );
}
treeWidget->insertTopLevelItems( 0, QgsCustomization::instance()->mMainWindowItems );
- for (int i = 0; i < treeWidget->topLevelItemCount(); i++)
- treeWidget->expandItem( treeWidget->topLevelItem(i) );
+ for ( int i = 0; i < treeWidget->topLevelItemCount(); i++ )
+ treeWidget->expandItem( treeWidget->topLevelItem( i ) );
// load check states from the settings
reset();
- treeWidget->sortItems(0, Qt::AscendingOrder);
- treeWidget->resizeColumnToContents(0);
+ treeWidget->sortItems( 0, Qt::AscendingOrder );
+ treeWidget->resizeColumnToContents( 0 );
}
QTreeWidgetItem * QgsCustomizationDialog::createTreeItemWidgets()
@@ -281,11 +288,11 @@ QTreeWidgetItem * QgsCustomizationDialog::createTreeItemWidgets()
QDomDocument myDoc( "QgsWidgets" );
QFile myFile( QgsApplication::pkgDataPath() + "/resources/customization.xml" );
- if( !myFile.open( QIODevice::ReadOnly ) )
+ if ( !myFile.open( QIODevice::ReadOnly ) )
{
return NULL;
}
- if( !myDoc.setContent( &myFile ) )
+ if ( !myDoc.setContent( &myFile ) )
{
myFile.close();
return NULL;
@@ -293,63 +300,64 @@ QTreeWidgetItem * QgsCustomizationDialog::createTreeItemWidgets()
myFile.close();
QDomElement myRoot = myDoc.documentElement();
- if( myRoot.tagName() != "qgiswidgets" )
+ if ( myRoot.tagName() != "qgiswidgets" )
{
return NULL;
}
- QTreeWidgetItem *myItem = readWidgetsXmlNode ( myRoot );
- myItem->setData ( 0, Qt::DisplayRole, tr("Widgets" ) );
-
+ QTreeWidgetItem *myItem = readWidgetsXmlNode( myRoot );
+ myItem->setData( 0, Qt::DisplayRole, tr( "Widgets" ) );
+
return myItem;
}
-QTreeWidgetItem * QgsCustomizationDialog::readWidgetsXmlNode ( QDomNode theNode )
+QTreeWidgetItem * QgsCustomizationDialog::readWidgetsXmlNode( QDomNode theNode )
{
QgsDebugMsg( "Entered" );
QDomElement myElement = theNode.toElement();
- QString name = myElement.attribute( "objectName", "");
+ QString name = myElement.attribute( "objectName", "" );
QStringList data( name );
- data << myElement.attribute( "label", name);
- data << myElement.attribute( "description", "");
-
- QTreeWidgetItem *myItem = new QTreeWidgetItem ( data );
+ data << myElement.attribute( "label", name );
+ data << myElement.attribute( "description", "" );
+
+ QTreeWidgetItem *myItem = new QTreeWidgetItem( data );
// It is nice to have icons for each Qt widget class, is it too heavy?
// There are 47 png files, total 196K in qt/tools/designer/src/components/formeditor/images/
- QString iconName = myElement.attribute( "class", "" ).toLower().mid(1) + ".png";
+ QString iconName = myElement.attribute( "class", "" ).toLower().mid( 1 ) + ".png";
QString iconPath = QgsApplication::iconPath( "/customization/" + iconName );
QgsDebugMsg( "iconPath = " + iconPath );
- if ( QFile::exists( iconPath ) )
+ if ( QFile::exists( iconPath ) )
{
- myItem->setIcon (0, QIcon(iconPath) );
+ myItem->setIcon( 0, QIcon( iconPath ) );
}
- myItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- myItem->setCheckState(0, Qt::Checked);
+ myItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ myItem->setCheckState( 0, Qt::Checked );
QDomNode n = theNode.firstChild();
- while( !n.isNull() )
+ while ( !n.isNull() )
{
QDomElement e = n.toElement();
- if( !e.isNull() )
+ if ( !e.isNull() )
{
- QTreeWidgetItem *wi = readWidgetsXmlNode ( n );
- myItem->insertChild ( 0, wi );
+ QTreeWidgetItem *wi = readWidgetsXmlNode( n );
+ myItem->insertChild( 0, wi );
}
n = n.nextSibling();
}
return myItem;
}
-bool QgsCustomizationDialog::switchWidget ( QWidget * widget, QMouseEvent *event )
+bool QgsCustomizationDialog::switchWidget( QWidget * widget, QMouseEvent *event )
{
- QgsDebugMsg ( "Entered" );
- if ( !actionCatch->isChecked() ) { return false; }
- QString path = widgetPath(widget);
- QgsDebugMsg ( "path = " + path );
+ QgsDebugMsg( "Entered" );
+ if ( !actionCatch->isChecked() )
+ return false;
+ QString path = widgetPath( widget );
+ QgsDebugMsg( "path = " + path );
- if ( path.startsWith ( "/QgsCustomizationDialogBase" ) )
+ if ( path.startsWith( "/QgsCustomizationDialogBase" ) )
{
// do not allow modification of this dialog
return false;
@@ -358,13 +366,13 @@ bool QgsCustomizationDialog::switchWidget ( QWidget * widget, QMouseEvent *event
{
// changes to main window
// (work with toolbars, tool buttons)
- if (widget->inherits("QToolBar"))
+ if ( widget->inherits( "QToolBar" ) )
{
path = "/Toolbars/" + widget->objectName();
}
- else if (widget->inherits("QToolButton"))
+ else if ( widget->inherits( "QToolButton" ) )
{
- QToolButton* toolbutton = qobject_cast(widget);
+ QToolButton* toolbutton = qobject_cast( widget );
QAction* action = toolbutton->defaultAction();
QString toolbarName = widget->parent()->objectName();
QString actionName = action->objectName();
@@ -382,20 +390,22 @@ bool QgsCustomizationDialog::switchWidget ( QWidget * widget, QMouseEvent *event
path = "/Widgets" + path;
}
- QgsDebugMsg ( "path final = " + path );
- bool on = !itemChecked ( path );
+ QgsDebugMsg( "path final = " + path );
+ bool on = !itemChecked( path );
- QgsDebugMsg ( QString ( "on = %1" ).arg(on) );
+ QgsDebugMsg( QString( "on = %1" ).arg( on ) );
- setItemChecked ( path, on );
- QTreeWidgetItem *myItem = item ( path );
- if ( myItem ) {
- treeWidget->scrollToItem ( myItem, QAbstractItemView::PositionAtCenter );
- treeWidget->clearSelection();
- myItem->setSelected ( true );
+ setItemChecked( path, on );
+ QTreeWidgetItem *myItem = item( path );
+ if ( myItem )
+ {
+ treeWidget->scrollToItem( myItem, QAbstractItemView::PositionAtCenter );
+ treeWidget->clearSelection();
+ myItem->setSelected( true );
QString style;
- if ( !on ) {
+ if ( !on )
+ {
style = "background-color: #FFCCCC;";
}
widget->setStyleSheet( style );
@@ -404,19 +414,20 @@ bool QgsCustomizationDialog::switchWidget ( QWidget * widget, QMouseEvent *event
return true;
}
-QString QgsCustomizationDialog::widgetPath ( QWidget * theWidget, QString thePath )
+QString QgsCustomizationDialog::widgetPath( QWidget * theWidget, QString thePath )
{
// go up until QDialog is reached
QString name = theWidget->objectName();
QString path = thePath;
- if ( !QgsCustomization::mInternalWidgets.contains ( name ) )
+ if ( !QgsCustomization::mInternalWidgets.contains( name ) )
{
- if ( !path.isEmpty() ) {
+ if ( !path.isEmpty() )
+ {
path = name + "/" + path;
- }
- else
+ }
+ else
{
path = name;
}
@@ -424,145 +435,145 @@ QString QgsCustomizationDialog::widgetPath ( QWidget * theWidget, QString thePat
QWidget * parent = theWidget->parentWidget();
- if ( !parent || theWidget->inherits("QDialog") )
+ if ( !parent || theWidget->inherits( "QDialog" ) )
{
return "/" + path;
}
- return widgetPath ( parent, path );
+ return widgetPath( parent, path );
}
-void QgsCustomizationDialog::setCatch ( bool on )
+void QgsCustomizationDialog::setCatch( bool on )
{
- actionCatch->setChecked ( on );
+ actionCatch->setChecked( on );
}
-bool QgsCustomizationDialog::catchOn ( )
+bool QgsCustomizationDialog::catchOn( )
{
- return actionCatch->isChecked ( );
+ return actionCatch->isChecked( );
}
-void QgsCustomization::addTreeItemActions(QTreeWidgetItem* parentItem, const QList& actions)
+void QgsCustomization::addTreeItemActions( QTreeWidgetItem* parentItem, const QList& actions )
{
- foreach (QAction* action, actions)
+ foreach( QAction* action, actions )
{
- if (action->menu())
+ if ( action->menu() )
{
// it is a submenu
- addTreeItemMenu(parentItem, action->menu());
+ addTreeItemMenu( parentItem, action->menu() );
}
else
{
// it is an ordinary action
QStringList strs;
strs << action->objectName() << action->text();
- QTreeWidgetItem* myItem = new QTreeWidgetItem(parentItem, strs);
+ QTreeWidgetItem* myItem = new QTreeWidgetItem( parentItem, strs );
myItem->setIcon( 0, action->icon() );
- myItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- myItem->setCheckState(0, Qt::Checked);
+ myItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ myItem->setCheckState( 0, Qt::Checked );
}
}
}
-void QgsCustomization::addTreeItemMenu(QTreeWidgetItem* parentItem, QMenu* menu)
+void QgsCustomization::addTreeItemMenu( QTreeWidgetItem* parentItem, QMenu* menu )
{
QStringList menustrs;
menustrs << menu->objectName() << menu->title();
- QTreeWidgetItem* menuItem = new QTreeWidgetItem( parentItem, menustrs);
- menuItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- menuItem->setCheckState(0, Qt::Checked);
+ QTreeWidgetItem* menuItem = new QTreeWidgetItem( parentItem, menustrs );
+ menuItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ menuItem->setCheckState( 0, Qt::Checked );
- addTreeItemActions(menuItem, menu->actions());
+ addTreeItemActions( menuItem, menu->actions() );
}
-void QgsCustomization::createTreeItemMenus ( )
+void QgsCustomization::createTreeItemMenus( )
{
QStringList data;
data << "Menus";
- QTreeWidgetItem *topItem = new QTreeWidgetItem ( data );
+ QTreeWidgetItem *topItem = new QTreeWidgetItem( data );
QMenuBar* menubar = QgisApp::instance()->menuBar();
- foreach (QObject* obj, menubar->children())
+ foreach( QObject* obj, menubar->children() )
{
- if (obj->inherits("QMenu"))
+ if ( obj->inherits( "QMenu" ) )
{
- QMenu* menu = qobject_cast(obj);
- addTreeItemMenu(topItem, menu);
+ QMenu* menu = qobject_cast( obj );
+ addTreeItemMenu( topItem, menu );
}
}
mMainWindowItems << topItem;
}
-void QgsCustomization::createTreeItemToolbars ( )
+void QgsCustomization::createTreeItemToolbars( )
{
QStringList data;
data << "Toolbars";
- QTreeWidgetItem *topItem = new QTreeWidgetItem ( data );
+ QTreeWidgetItem *topItem = new QTreeWidgetItem( data );
QMainWindow* mw = QgisApp::instance();
- foreach (QObject* obj, mw->children())
+ foreach( QObject* obj, mw->children() )
{
- if (obj->inherits("QToolBar"))
+ if ( obj->inherits( "QToolBar" ) )
{
- QToolBar* tb = qobject_cast(obj);
+ QToolBar* tb = qobject_cast( obj );
QStringList tbstrs;
tbstrs << tb->objectName() << tb->windowTitle();
QTreeWidgetItem* tbItem = new QTreeWidgetItem( topItem, tbstrs );
- tbItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- tbItem->setCheckState(0, Qt::Checked);
+ tbItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ tbItem->setCheckState( 0, Qt::Checked );
- addTreeItemActions(tbItem, tb->actions());
+ addTreeItemActions( tbItem, tb->actions() );
}
}
mMainWindowItems << topItem;
}
-void QgsCustomization::createTreeItemDocks ( )
+void QgsCustomization::createTreeItemDocks( )
{
QStringList data;
data << "Docks";
- QTreeWidgetItem *topItem = new QTreeWidgetItem ( data );
+ QTreeWidgetItem *topItem = new QTreeWidgetItem( data );
QMainWindow* mw = QgisApp::instance();
- foreach (QObject* obj, mw->children())
+ foreach( QObject* obj, mw->children() )
{
- if (obj->inherits("QDockWidget"))
+ if ( obj->inherits( "QDockWidget" ) )
{
- QDockWidget* dw = qobject_cast (obj);
+ QDockWidget* dw = qobject_cast ( obj );
QStringList dwstrs;
dwstrs << dw->objectName() << dw->windowTitle();
QTreeWidgetItem* dwItem = new QTreeWidgetItem( topItem, dwstrs );
- dwItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- dwItem->setCheckState(0, Qt::Checked);
+ dwItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ dwItem->setCheckState( 0, Qt::Checked );
}
}
mMainWindowItems << topItem;
}
-void QgsCustomization::createTreeItemStatus ( )
+void QgsCustomization::createTreeItemStatus( )
{
QStringList data;
data << "StatusBar";
- QTreeWidgetItem *topItem = new QTreeWidgetItem ( data );
- topItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- topItem->setCheckState(0, Qt::Checked);
+ QTreeWidgetItem *topItem = new QTreeWidgetItem( data );
+ topItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ topItem->setCheckState( 0, Qt::Checked );
QStatusBar* sb = QgisApp::instance()->statusBar();
- foreach (QObject* obj, sb->children())
+ foreach( QObject* obj, sb->children() )
{
- if (obj->inherits("QWidget") && !obj->objectName().isEmpty())
+ if ( obj->inherits( "QWidget" ) && !obj->objectName().isEmpty() )
{
QStringList strs;
strs << obj->objectName();
QTreeWidgetItem* item = new QTreeWidgetItem( topItem, strs );
- item->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
- item->setCheckState(0, Qt::Checked);
+ item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
+ item->setCheckState( 0, Qt::Checked );
}
}
@@ -582,10 +593,10 @@ QgsCustomization *QgsCustomization::instance()
}
QgsCustomization::QgsCustomization( ) :
- pDialog(0),
- mEnabled(true),
- mStatusPath("/Customization/status"),
- mSettings ( "QuantumGIS", "QGISCUSTOMIZATION" )
+ pDialog( 0 ),
+ mEnabled( true ),
+ mStatusPath( "/Customization/status" ),
+ mSettings( "QuantumGIS", "QGISCUSTOMIZATION" )
{
QgsDebugMsg( "Entered" );
}
@@ -602,29 +613,29 @@ void QgsCustomization::updateMainWindow( QMenu * theToolBarMenu )
createTreeItemDocks();
createTreeItemStatus();
- if (!mEnabled)
+ if ( !mEnabled )
return;
QMainWindow* mw = QgisApp::instance();
QMenuBar* menubar = mw->menuBar();
- mSettings.beginGroup("Customization/Menus");
+ mSettings.beginGroup( "Customization/Menus" );
// hide menus and menu actions
- foreach (QObject* obj, menubar->children())
+ foreach( QObject* obj, menubar->children() )
{
- if (obj->inherits("QMenu"))
+ if ( obj->inherits( "QMenu" ) )
{
- QMenu* menu = qobject_cast(obj);
- bool visible = mSettings.value(menu->objectName(), true).toBool();
- if (!visible)
+ QMenu* menu = qobject_cast( obj );
+ bool visible = mSettings.value( menu->objectName(), true ).toBool();
+ if ( !visible )
{
- menubar->removeAction(menu->menuAction());
+ menubar->removeAction( menu->menuAction() );
}
else
{
- updateMenu(menu, mSettings);
+ updateMenu( menu, mSettings );
}
}
}
@@ -633,28 +644,28 @@ void QgsCustomization::updateMainWindow( QMenu * theToolBarMenu )
// remove toolbars, toolbar actions
- mSettings.beginGroup("Customization/Toolbars");
- foreach (QObject* obj, mw->children())
+ mSettings.beginGroup( "Customization/Toolbars" );
+ foreach( QObject* obj, mw->children() )
{
- if (obj->inherits("QToolBar"))
+ if ( obj->inherits( "QToolBar" ) )
{
- QToolBar* tb = qobject_cast(obj);
- bool visible = mSettings.value(tb->objectName(), true).toBool();
- if (!visible)
+ QToolBar* tb = qobject_cast( obj );
+ bool visible = mSettings.value( tb->objectName(), true ).toBool();
+ if ( !visible )
{
- mw->removeToolBar(tb);
+ mw->removeToolBar( tb );
// remove also from menu, because toolbars removed here, switched on later from menu don't work correctly
- theToolBarMenu->removeAction( tb->toggleViewAction() );
+ theToolBarMenu->removeAction( tb->toggleViewAction() );
}
else
{
- mSettings.beginGroup(tb->objectName());
+ mSettings.beginGroup( tb->objectName() );
// hide individual toolbar actions
- foreach (QAction* action, tb->actions())
+ foreach( QAction* action, tb->actions() )
{
- visible = mSettings.value(action->objectName(), true).toBool();
- if (!visible)
- tb->removeAction(action);
+ visible = mSettings.value( action->objectName(), true ).toBool();
+ if ( !visible )
+ tb->removeAction( action );
}
mSettings.endGroup();
}
@@ -665,15 +676,15 @@ void QgsCustomization::updateMainWindow( QMenu * theToolBarMenu )
// remove dock widgets
- mSettings.beginGroup("Customization/Docks");
- foreach (QObject* obj, mw->children())
+ mSettings.beginGroup( "Customization/Docks" );
+ foreach( QObject* obj, mw->children() )
{
- if (obj->inherits("QDockWidget"))
+ if ( obj->inherits( "QDockWidget" ) )
{
- bool visible = mSettings.value(obj->objectName(), true).toBool();
- if (!visible)
+ bool visible = mSettings.value( obj->objectName(), true ).toBool();
+ if ( !visible )
{
- mw->removeDockWidget(qobject_cast(obj));
+ mw->removeDockWidget( qobject_cast( obj ) );
}
}
}
@@ -682,20 +693,20 @@ void QgsCustomization::updateMainWindow( QMenu * theToolBarMenu )
// remove status bar widgets
- if (mSettings.value("Customization/StatusBar", true).toBool())
+ if ( mSettings.value( "Customization/StatusBar", true ).toBool() )
{
- mSettings.beginGroup("Customization/StatusBar");
+ mSettings.beginGroup( "Customization/StatusBar" );
QStatusBar* sb = mw->statusBar();
- foreach (QObject* obj, sb->children())
+ foreach( QObject* obj, sb->children() )
{
- if (obj->inherits("QWidget"))
+ if ( obj->inherits( "QWidget" ) )
{
- QWidget* widget = qobject_cast(obj);
- bool visible = mSettings.value(widget->objectName(), true).toBool();
- if (!visible)
+ QWidget* widget = qobject_cast( obj );
+ bool visible = mSettings.value( widget->objectName(), true ).toBool();
+ if ( !visible )
{
- sb->removeWidget(widget);
+ sb->removeWidget( widget );
}
}
}
@@ -709,20 +720,20 @@ void QgsCustomization::updateMainWindow( QMenu * theToolBarMenu )
}
}
-void QgsCustomization::updateMenu(QMenu* menu, QSettings& settings)
+void QgsCustomization::updateMenu( QMenu* menu, QSettings& settings )
{
- settings.beginGroup(menu->objectName());
+ settings.beginGroup( menu->objectName() );
// hide individual menu actions and call recursively on visible submenus
- foreach (QAction* action, menu->actions())
+ foreach( QAction* action, menu->actions() )
{
- QString objName = (action->menu() ? action->menu()->objectName() : action->objectName());
- bool visible = settings.value(objName, true).toBool();
- if (!visible)
- menu->removeAction(action);
- else if (action->menu())
+ QString objName = ( action->menu() ? action->menu()->objectName() : action->objectName() );
+ bool visible = settings.value( objName, true ).toBool();
+ if ( !visible )
+ menu->removeAction( action );
+ else if ( action->menu() )
{
// it is a submenu - let's look if there isn't something to remove
- updateMenu(action->menu(), settings);
+ updateMenu( action->menu(), settings );
}
}
settings.endGroup();
@@ -731,9 +742,10 @@ void QgsCustomization::updateMenu(QMenu* menu, QSettings& settings)
void QgsCustomization::openDialog()
{
QgsDebugMsg( "Entered" );
- if ( !pDialog ) {
+ if ( !pDialog )
+ {
pDialog = new QgsCustomizationDialog();
- }
+ }
// I am trying too enable switching widget status by clicking in main app, so I need non modal
pDialog->show();
@@ -742,11 +754,12 @@ void QgsCustomization::openDialog()
void QgsCustomization::customizeWidget( QWidget * widget, QEvent * event )
{
// Test if the widget is child of QDialog
- if ( !widget->inherits("QDialog") ) return;
+ if ( !widget->inherits( "QDialog" ) )
+ return;
- QgsDebugMsg( QString ( "objectName = %1 event type = %2" ).arg( widget->objectName()).arg( event->type() ) );
+ QgsDebugMsg( QString( "objectName = %1 event type = %2" ).arg( widget->objectName() ).arg( event->type() ) );
- QgsDebugMsg( QString ( "%1 x %2").arg(typeid( *widget ).name()).arg(typeid( QDialog ).name() ));
+ QgsDebugMsg( QString( "%1 x %2" ).arg( widget->metaObject()->className() ).arg( QDialog::staticMetaObject.className() ) );
QString path = "/Customization/Widgets/";
QgsCustomization::customizeWidget( path, widget );
@@ -754,30 +767,31 @@ void QgsCustomization::customizeWidget( QWidget * widget, QEvent * event )
void QgsCustomization::customizeWidget( QString thePath, QWidget * theWidget )
{
- QSettings mySettings ("QuantumGIS", "QGISCUSTOMIZATION" );
+ QSettings mySettings( "QuantumGIS", "QGISCUSTOMIZATION" );
QString name = theWidget->objectName();
QString myPath = thePath;
- // Qt may insert some internal classes in the tree, e.g. QTabWidgetPrivate inserts
+ // Qt may insert some internal classes in the tree, e.g. QTabWidgetPrivate inserts
// qt_tabwidget_stackedwidget, such widgets do not appear in the tree generated
// from ui files and do not have sense from user poin of view -> skip
-
- if ( !QgsCustomization::mInternalWidgets.contains ( name ) )
+
+ if ( !QgsCustomization::mInternalWidgets.contains( name ) )
{
- myPath = thePath + "/" + name;
+ myPath = thePath + "/" + name;
}
QObjectList children = theWidget->children();
QObjectList::iterator i;
- for ( i = children.begin(); i != children.end(); ++i)
+ for ( i = children.begin(); i != children.end(); ++i )
{
- if ( !(*i)->inherits("QWidget") ) continue;
- QWidget * w = qobject_cast(*i);
+ if ( !( *i )->inherits( "QWidget" ) )
+ continue;
+ QWidget * w = qobject_cast( *i );
QString p = myPath + "/" + w->objectName();
bool on = mySettings.value( p, true ).toBool();
- QgsDebugMsg( QString("p = %1 on = %2").arg(p).arg(on) );
+ QgsDebugMsg( QString( "p = %1 on = %2" ).arg( p ).arg( on ) );
if ( on )
{
QgsCustomization::customizeWidget( myPath, w );
@@ -802,19 +816,20 @@ void QgsCustomization::customizeWidget( QString thePath, QWidget * theWidget )
void QgsCustomization::removeFromLayout( QLayout *theLayout, QWidget * theWidget )
{
- if ( theLayout->indexOf( theWidget ) >= 0 )
+ if ( theLayout->indexOf( theWidget ) >= 0 )
{
- theLayout->removeWidget ( theWidget );
+ theLayout->removeWidget( theWidget );
return;
- }
+ }
else
{
QObjectList children = theLayout->children();
QObjectList::iterator i;
- for ( i = children.begin(); i != children.end(); ++i)
+ for ( i = children.begin(); i != children.end(); ++i )
{
- if ( !(*i)->inherits("QLayout") ) continue;
- QLayout *l = qobject_cast(*i);
+ if ( !( *i )->inherits( "QLayout" ) )
+ continue;
+ QLayout *l = qobject_cast( *i );
QgsCustomization::removeFromLayout( l, theWidget );
}
@@ -823,42 +838,44 @@ void QgsCustomization::removeFromLayout( QLayout *theLayout, QWidget * theWidget
void QgsCustomization::preNotify( QObject * receiver, QEvent * event, bool * done )
{
- QWidget * widget = 0;
- if ( receiver->isWidgetType() )
- {
- widget = static_cast( receiver );
- }
+ QWidget *widget = qobject_cast( receiver );
if ( mEnabled && widget && event->type() == QEvent::Show )
{
- QgsCustomization::customizeWidget ( widget, event );
- if ( widget->inherits("QDialog") && pDialog && pDialog->isVisible() ) {
+ QgsCustomization::customizeWidget( widget, event );
+ if ( widget->inherits( "QDialog" ) && pDialog && pDialog->isVisible() )
+ {
+ // TODO?
}
}
- else if ( mEnabled && widget && (event->type() == QEvent::Hide || event->type() == QEvent::Close) )
+ else if ( mEnabled && widget && ( event->type() == QEvent::Hide || event->type() == QEvent::Close ) )
{
- if ( widget->inherits("QDialog") && pDialog && pDialog->isVisible() ){
+ if ( widget->inherits( "QDialog" ) && pDialog && pDialog->isVisible() )
+ {
+ // TODO?
}
}
else if ( widget && event->type() == QEvent::MouseButtonPress )
{
QgsDebugMsg( "click" );
- if ( pDialog && pDialog->isVisible() ) {
- QMouseEvent *e = static_cast(event);
- *done = pDialog->switchWidget ( widget, e );
+ if ( pDialog && pDialog->isVisible() )
+ {
+ QMouseEvent *e = static_cast( event );
+ *done = pDialog->switchWidget( widget, e );
}
}
- // Shortcut arrives only if it is defined and used in main app
+ // Shortcut arrives only if it is defined and used in main app
// This would be also possible without necessity to add shortcut to main app
// but it is better to have it there to avoid future conflicts
else if ( event->type() == QEvent::KeyPress )
{
- if ( pDialog && pDialog->isVisible() ) {
- QKeyEvent *e = static_cast(event);
- QgsDebugMsg( QString("key = %1 modifiers = %2").arg(e->key()).arg(e->modifiers() ) ) ;
+ if ( pDialog && pDialog->isVisible() )
+ {
+ QKeyEvent *e = static_cast( event );
+ QgsDebugMsg( QString( "key = %1 modifiers = %2" ).arg( e->key() ).arg( e->modifiers() ) ) ;
if ( e->key() == Qt::Key_M && e->modifiers() == Qt::ControlModifier )
{
- pDialog->setCatch ( !pDialog->catchOn() );
+ pDialog->setCatch( !pDialog->catchOn() );
}
}
}
@@ -869,31 +886,32 @@ void QgsCustomization::loadDefault()
QSettings mySettings;
// Check customization state
- int status = mySettings.value( mStatusPath, QgsCustomization::NotSet).toInt();
+ int status = mySettings.value( mStatusPath, QgsCustomization::NotSet ).toInt();
QgsDebugMsg( "Status path = " + mStatusPath );
- QgsDebugMsg( QString("status = %1").arg(status) );
- if ( status == QgsCustomization::User || status == QgsCustomization::Default ) return;
-
- // Look for default
+ QgsDebugMsg( QString( "status = %1" ).arg( status ) );
+ if ( status == QgsCustomization::User || status == QgsCustomization::Default )
+ return;
+
+ // Look for default
QString path = QgsApplication::pkgDataPath() + "/resources/customization.ini";
- if ( ! QFile::exists( path ) )
+ if ( ! QFile::exists( path ) )
{
- QgsDebugMsg( "Default customization not found in " + path );
+ QgsDebugMsg( "Default customization not found in " + path );
return;
}
QgsDebugMsg( "Loading default customization from " + path );
- QSettings fileSettings( path, QSettings::IniFormat);
+ QSettings fileSettings( path, QSettings::IniFormat );
QStringList keys = fileSettings.allKeys();
- QgsDebugMsg( QString("size = %1").arg( keys.size () ) );
+ QgsDebugMsg( QString( "size = %1" ).arg( keys.size() ) );
QStringList::const_iterator i;
- for ( i = keys.begin(); i != keys.end(); ++i)
+ for ( i = keys.begin(); i != keys.end(); ++i )
{
- QString p(*i);
+ QString p( *i );
- bool val = fileSettings.value(p).toBool();
+ bool val = fileSettings.value( p ).toBool();
- mSettings.setValue(p, val);
+ mSettings.setValue( p, val );
}
- mySettings.setValue(mStatusPath, QgsCustomization::Default);
+ mySettings.setValue( mStatusPath, QgsCustomization::Default );
}
diff --git a/src/app/qgscustomization.h b/src/app/qgscustomization.h
index 12238642116..52ce084e1e9 100644
--- a/src/app/qgscustomization.h
+++ b/src/app/qgscustomization.h
@@ -1,5 +1,5 @@
/***************************************************************************
- qgscustomization.h - Customization
+ qgscustomization.h - Customization
-------------------
begin : 2011-04-01
copyright : (C) 2011 Radim Blazek
@@ -39,14 +39,14 @@ class QgsCustomizationDialog : public QMainWindow, private Ui::QgsCustomizationD
~QgsCustomizationDialog();
// get item by path
- QTreeWidgetItem *item ( QString thePath, QTreeWidgetItem *theItem=0 );
+ QTreeWidgetItem *item( QString thePath, QTreeWidgetItem *theItem = 0 );
- //
+ //
// return current item state for given path
- bool itemChecked ( QString thePath );
+ bool itemChecked( QString thePath );
// set item state for given path
- void setItemChecked ( QString thePath, bool on );
+ void setItemChecked( QString thePath, bool on );
// recursively save tree item to settings
void itemToSettings( QString thePath, QTreeWidgetItem *theItem, QSettings *theSettings );
@@ -54,19 +54,19 @@ class QgsCustomizationDialog : public QMainWindow, private Ui::QgsCustomizationD
void settingsToItem( QString thePath, QTreeWidgetItem *theItem, QSettings *theSettings );
// save current tree to settings
- void treeToSettings ( QSettings *theSettings );
+ void treeToSettings( QSettings *theSettings );
// restore current tree from settings
- void settingsToTree ( QSettings *theSettings );
+ void settingsToTree( QSettings *theSettings );
// switch widget item in tree
- bool switchWidget ( QWidget * widget, QMouseEvent *event );
+ bool switchWidget( QWidget * widget, QMouseEvent *event );
- // Get path of the widget
- QString widgetPath ( QWidget * theWidget, QString thePath = QString() );
+ // Get path of the widget
+ QString widgetPath( QWidget * theWidget, QString thePath = QString() );
- void setCatch ( bool on );
- bool catchOn ( );
+ void setCatch( bool on );
+ bool catchOn( );
private slots:
//void on_btnQgisUser_clicked();
@@ -92,8 +92,8 @@ class QgsCustomizationDialog : public QMainWindow, private Ui::QgsCustomizationD
private:
void init();
- QTreeWidgetItem * createTreeItemWidgets ( );
- QTreeWidgetItem * readWidgetsXmlNode ( QDomNode theNode );
+ QTreeWidgetItem * createTreeItemWidgets( );
+ QTreeWidgetItem * readWidgetsXmlNode( QDomNode theNode );
QString mLastDirSettingsName;
QSettings mSettings;
@@ -122,7 +122,7 @@ class QgsCustomization : public QObject
void updateMainWindow( QMenu * theToolBarMenu );
// make sure to enable/disable before creating QgisApp in order to get it customized (or not)
- void setEnabled(bool enabled) { mEnabled = enabled; }
+ void setEnabled( bool enabled ) { mEnabled = enabled; }
bool isEnabled() const { return mEnabled; }
// Load and set default customization
@@ -144,13 +144,13 @@ class QgsCustomization : public QObject
bool mEnabled;
QString mStatusPath;
- void updateMenu(QMenu* menu, QSettings& settings);
- void createTreeItemMenus ( );
- void createTreeItemToolbars ( );
- void createTreeItemDocks ( );
- void createTreeItemStatus ( );
- void addTreeItemMenu(QTreeWidgetItem* parentItem, QMenu* menu);
- void addTreeItemActions(QTreeWidgetItem* parentItem, const QList& actions);
+ void updateMenu( QMenu* menu, QSettings& settings );
+ void createTreeItemMenus( );
+ void createTreeItemToolbars( );
+ void createTreeItemDocks( );
+ void createTreeItemStatus( );
+ void addTreeItemMenu( QTreeWidgetItem* parentItem, QMenu* menu );
+ void addTreeItemActions( QTreeWidgetItem* parentItem, const QList& actions );
QList mMainWindowItems;
friend class QgsCustomizationDialog; // in order to access mMainWindowItems
diff --git a/src/app/qgsmaptooladdpart.cpp b/src/app/qgsmaptooladdpart.cpp
index 85eff4e56d8..38e5f4f35fa 100644
--- a/src/app/qgsmaptooladdpart.cpp
+++ b/src/app/qgsmaptooladdpart.cpp
@@ -134,6 +134,9 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )
stopCapturing();
}
break;
+ default:
+ Q_ASSERT( !"invalid capture mode" );
+ break;
}
QString errorMessage;
diff --git a/src/app/qgspluginmanager.cpp b/src/app/qgspluginmanager.cpp
index eec2a7d09d9..de16c507802 100644
--- a/src/app/qgspluginmanager.cpp
+++ b/src/app/qgspluginmanager.cpp
@@ -175,7 +175,8 @@ void QgsPluginManager::getPythonPluginDescriptions()
QString version = mPythonUtils->getPluginMetadata( packageName, "version" );
QString iconName = mPythonUtils->getPluginMetadata( packageName, "icon" );
- if ( pluginName == "__error__" || description == "__error__" || version == "__error__" ) continue;
+ if ( pluginName == "__error__" || description == "__error__" || version == "__error__" )
+ continue;
bool isCompatible = QgsPluginRegistry::instance()->isPythonPluginCompatible( packageName );
QString compatibleString; // empty by default
diff --git a/src/app/qgspluginregistry.cpp b/src/app/qgspluginregistry.cpp
index c141236355b..8e3a3b4736e 100644
--- a/src/app/qgspluginregistry.cpp
+++ b/src/app/qgspluginregistry.cpp
@@ -189,13 +189,16 @@ bool QgsPluginRegistry::checkQgisVersion( QString minVersion )
int minVerMajor, minVerMinor, minVerBugfix = 0;
bool ok;
minVerMajor = minVersionParts.at( 0 ).toInt( &ok );
- if ( !ok ) return false;
+ if ( !ok )
+ return false;
minVerMinor = minVersionParts.at( 1 ).toInt( &ok );
- if ( !ok ) return false;
+ if ( !ok )
+ return false;
if ( minVersionParts.count() == 3 )
{
minVerBugfix = minVersionParts.at( 2 ).toInt( &ok );
- if ( !ok ) return false;
+ if ( !ok )
+ return false;
}
// our qgis version - cut release name after version number
@@ -207,15 +210,19 @@ bool QgsPluginRegistry::checkQgisVersion( QString minVersion )
int qgisBugfix = qgisVersionParts.at( 2 ).toInt();
// first check major version
- if ( minVerMajor > qgisMajor ) return false;
- if ( minVerMajor < qgisMajor ) return true;
-
+ if ( minVerMajor > qgisMajor )
+ return false;
+ if ( minVerMajor < qgisMajor )
+ return true;
// if same, check minor version
- if ( minVerMinor > qgisMinor ) return false;
- if ( minVerMinor < qgisMinor ) return true;
+ if ( minVerMinor > qgisMinor )
+ return false;
+ if ( minVerMinor < qgisMinor )
+ return true;
// if still same, check bugfix version
- if ( minVerBugfix > qgisBugfix ) return false;
+ if ( minVerBugfix > qgisBugfix )
+ return false;
// looks like min version is the same as our version - that's fine
return true;
diff --git a/src/browser/main.cpp b/src/browser/main.cpp
index c479727ecfd..4752d972676 100644
--- a/src/browser/main.cpp
+++ b/src/browser/main.cpp
@@ -41,7 +41,7 @@ int main( int argc, char ** argv )
#if defined(Q_WS_WIN)
QString prefixPath = QApplication::applicationDirPath();
#else
- QString prefixPath = QApplication::applicationDirPath()+"/..";
+ QString prefixPath = QApplication::applicationDirPath() + "/..";
#endif
a.setPrefixPath( prefixPath, true );
a.initQgis();
@@ -51,7 +51,7 @@ int main( int argc, char ** argv )
QCoreApplication::setOrganizationDomain( "qgis.org" );
QCoreApplication::setApplicationName( "QGIS" );
-/*
+#if 0
QString myTranslationCode = "";
// This is mostly copy from Help viewer - not sure if important
@@ -76,28 +76,28 @@ int main( int argc, char ** argv )
}
}
QgsDebugMsg( QString( "Setting translation to %1/qgis_%2" ).arg( i18nPath ).arg( myTranslationCode ) );
-*/
+
/* Translation file for Qt.
* The strings from the QMenuBar context section are used by Qt/Mac to shift
* the About, Preferences and Quit items to the Mac Application menu.
* These items must be translated identically in both qt_ and qgis_ files.
*/
-/*
+
QTranslator qttor( 0 );
if ( qttor.load( QString( "qt_" ) + myTranslationCode, i18nPath ) )
{
a.installTranslator( &qttor );
}
-*/
+
/* Translation file for QGIS.
*/
-/*
+
QTranslator qgistor( 0 );
if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) )
{
a.installTranslator( &qgistor );
}
-*/
+#endif
QgsBrowser w;
diff --git a/src/browser/qgsbrowser.cpp b/src/browser/qgsbrowser.cpp
index 0820faf7f71..c15fff2e9c9 100644
--- a/src/browser/qgsbrowser.cpp
+++ b/src/browser/qgsbrowser.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- qgs.cpp -
+ qgsbrowser.cpp -
-------------------
begin : 2011-04-01
copyright : (C) 2011 Radim Blazek
@@ -15,11 +15,10 @@
* *
***************************************************************************/
/* $Id$ */
-#include
-
#include
#include
#include
+#include
#include "qgsapplication.h"
#include "qgsdataitem.h"
@@ -38,39 +37,39 @@
QgsBrowser::QgsBrowser( QWidget *parent, Qt::WFlags flags )
: QMainWindow( parent, flags ),
mDirtyMetadata( true ), mDirtyPreview( true ), mDirtyAttributes( true ),
- mLayer( 0 ), mParamWidget(0)
+ mLayer( 0 ), mParamWidget( 0 )
{
setupUi( this );
// Disable tabs by default
- tabWidget->setTabEnabled ( tabWidget->indexOf( paramTab ), false );
- tabWidget->setTabEnabled ( tabWidget->indexOf( metaTab ), false );
- tabWidget->setTabEnabled ( tabWidget->indexOf( previewTab ), false );
- tabWidget->setTabEnabled ( tabWidget->indexOf( attributesTab ), false );
-
- mModel = new QgsBrowserModel(treeView);
- treeView->setModel(mModel);
+ tabWidget->setTabEnabled( tabWidget->indexOf( paramTab ), false );
+ tabWidget->setTabEnabled( tabWidget->indexOf( metaTab ), false );
+ tabWidget->setTabEnabled( tabWidget->indexOf( previewTab ), false );
+ tabWidget->setTabEnabled( tabWidget->indexOf( attributesTab ), false );
+
+ mModel = new QgsBrowserModel( treeView );
+ treeView->setModel( mModel );
// Last expanded is stored, dont cover whole height with file system
//treeView->expand( mModel->index(0,0) );
- connect(treeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemClicked(const QModelIndex&)));
+ connect( treeView, SIGNAL( clicked( const QModelIndex& ) ), this, SLOT( itemClicked( const QModelIndex& ) ) );
- treeView->setExpandsOnDoubleClick (false);
- connect(treeView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(itemDoubleClicked(const QModelIndex&)));
- connect(treeView, SIGNAL(expanded(const QModelIndex&)), this, SLOT(itemExpanded(const QModelIndex&)));
+ treeView->setExpandsOnDoubleClick( false );
+ connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( itemDoubleClicked( const QModelIndex& ) ) );
+ connect( treeView, SIGNAL( expanded( const QModelIndex& ) ), this, SLOT( itemExpanded( const QModelIndex& ) ) );
- connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()));
+ connect( tabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( tabChanged() ) );
connect( mActionNewVectorLayer, SIGNAL( triggered() ), this, SLOT( newVectorLayer() ) );
- connect(stopRenderingButton, SIGNAL(clicked()), this, SLOT(stopRendering()) );
+ connect( stopRenderingButton, SIGNAL( clicked() ), this, SLOT( stopRendering() ) );
- mapCanvas->setCanvasColor(Qt::white);
+ mapCanvas->setCanvasColor( Qt::white );
- QSettings settings;
- QString lastPath = settings.value ( "/Browser/lastExpanded" ).toString();
- QgsDebugMsg ( "lastPath = " + lastPath );
+ QSettings settings;
+ QString lastPath = settings.value( "/Browser/lastExpanded" ).toString();
+ QgsDebugMsg( "lastPath = " + lastPath );
if ( !lastPath.isEmpty() )
{
expand( lastPath );
@@ -84,29 +83,29 @@ QgsBrowser::~QgsBrowser()
void QgsBrowser::expand( QString path, const QModelIndex& index )
{
- QStringList paths = path.split('/');
- for ( int i = 0; i < mModel->rowCount(index); i++ )
+ QStringList paths = path.split( '/' );
+ for ( int i = 0; i < mModel->rowCount( index ); i++ )
{
- QModelIndex idx = mModel->index(i, 0, index);
- QgsDataItem* ptr = (QgsDataItem*) idx.internalPointer();
+ QModelIndex idx = mModel->index( i, 0, index );
+ QgsDataItem* ptr = ( QgsDataItem* ) idx.internalPointer();
- if ( path.indexOf ( ptr->path() ) == 0 )
+ if ( path.indexOf( ptr->path() ) == 0 )
{
treeView->expand( idx );
- treeView->scrollTo (idx, QAbstractItemView::PositionAtTop );
+ treeView->scrollTo( idx, QAbstractItemView::PositionAtTop );
expand( path, idx );
break;
}
}
}
-void QgsBrowser::itemClicked(const QModelIndex& index)
+void QgsBrowser::itemClicked( const QModelIndex& index )
{
mIndex = index;
- QgsDataItem* ptr = (QgsDataItem*) index.internalPointer();
+ QgsDataItem* ptr = ( QgsDataItem* ) index.internalPointer();
- // Disable preview, attributes tab
+ // Disable preview, attributes tab
bool paramEnable = false;
bool metaEnable = false;
@@ -123,8 +122,9 @@ void QgsBrowser::itemClicked(const QModelIndex& index)
QList nolayers;
mapCanvas->setLayerSet( nolayers );
metaTextBrowser->clear();
- if ( mParamWidget ) {
- paramLayout->removeWidget ( mParamWidget );
+ if ( mParamWidget )
+ {
+ paramLayout->removeWidget( mParamWidget );
mParamWidget->hide();
delete mParamWidget;
mParamWidget = 0;
@@ -139,59 +139,61 @@ void QgsBrowser::itemClicked(const QModelIndex& index)
mParamWidget = ptr->paramWidget();
- if ( mParamWidget ) {
- paramLayout->addWidget ( mParamWidget );
+ if ( mParamWidget )
+ {
+ paramLayout->addWidget( mParamWidget );
mParamWidget->show();
paramEnable = true;
}
- if (ptr->type() == QgsDataItem::Layer)
+ if ( ptr->type() == QgsDataItem::Layer )
{
- QgsLayerItem* item = static_cast(ptr);
- bool res = layerClicked(item);
+ QgsLayerItem* item = static_cast( ptr );
+ bool res = layerClicked( item );
- if (res)
+ if ( res )
{
metaEnable = true;
previewEnable = true;
- if ( mLayer->type() == QgsMapLayer::VectorLayer ) {
+ if ( mLayer->type() == QgsMapLayer::VectorLayer )
+ {
attributesEnable = true;
}
}
}
else
{
- mActionSetProjection->setEnabled ( false );
+ mActionSetProjection->setEnabled( false );
}
// force update of the current tab
updateCurrentTab();
int selected = -1;
- if ( mLastTab.contains( typeid(*ptr).name() ) )
+ if ( mLastTab.contains( ptr->metaObject()->className() ) )
{
- selected = mLastTab[ typeid(*ptr).name()];
+ selected = mLastTab[ ptr->metaObject()->className() ];
}
// Enabling tabs call tabChanged !
- tabWidget->setTabEnabled ( tabWidget->indexOf( paramTab ), paramEnable);
- tabWidget->setTabEnabled ( tabWidget->indexOf( metaTab ), metaEnable );
- tabWidget->setTabEnabled ( tabWidget->indexOf( previewTab ), previewEnable );
- tabWidget->setTabEnabled ( tabWidget->indexOf( attributesTab ), attributesEnable );
+ tabWidget->setTabEnabled( tabWidget->indexOf( paramTab ), paramEnable );
+ tabWidget->setTabEnabled( tabWidget->indexOf( metaTab ), metaEnable );
+ tabWidget->setTabEnabled( tabWidget->indexOf( previewTab ), previewEnable );
+ tabWidget->setTabEnabled( tabWidget->indexOf( attributesTab ), attributesEnable );
// select tab according last selection for this data item
- if ( selected >= 0 )
+ if ( selected >= 0 )
{
- qDebug("set tab %s %d", typeid(*ptr).name(), selected );
- tabWidget->setCurrentIndex ( selected );
+ qDebug( "set tab %s %d", ptr->metaObject()->className(), selected );
+ tabWidget->setCurrentIndex( selected );
}
- qDebug("clicked: %d %d %s", index.row(), index.column(), ptr->name().toAscii().data());
+ qDebug( "clicked: %d %d %s", index.row(), index.column(), ptr->name().toAscii().data() );
}
-bool QgsBrowser::layerClicked(QgsLayerItem* ptr)
+bool QgsBrowser::layerClicked( QgsLayerItem* ptr )
{
- mActionSetProjection->setEnabled ( ptr->capabilities() & QgsLayerItem::SetCrs );
+ mActionSetProjection->setEnabled( ptr->capabilities() & QgsLayerItem::SetCrs );
QString uri = ptr->uri();
if ( !uri.isEmpty() )
@@ -199,14 +201,14 @@ bool QgsBrowser::layerClicked(QgsLayerItem* ptr)
QgsMapLayer::LayerType type = ptr->mapLayerType();
QString providerKey = ptr->providerKey();
- QgsDebugMsg ( providerKey + " : " + uri );
- if ( type == QgsMapLayer::VectorLayer )
+ QgsDebugMsg( providerKey + " : " + uri );
+ if ( type == QgsMapLayer::VectorLayer )
{
- mLayer = new QgsVectorLayer( uri, QString(), providerKey);
+ mLayer = new QgsVectorLayer( uri, QString(), providerKey );
}
- if ( type == QgsMapLayer::RasterLayer )
+ if ( type == QgsMapLayer::RasterLayer )
{
- // This should go to WMS provider
+ // This should go to WMS provider
QStringList URIParts = uri.split( "|" );
QString rasterLayerPath = URIParts.at( 0 );
QStringList layers;
@@ -220,13 +222,17 @@ bool QgsBrowser::layerClicked(QgsLayerItem* ptr)
QString field = part.left( pos );
QString value = part.mid( pos + 1 );
- if ( field == "layers" ) layers = value.split(",");
- if ( field == "styles" ) styles = value.split(",");
- if ( field == "format" ) format = value;
- if ( field == "crs" ) crs = value;
+ if ( field == "layers" )
+ layers = value.split( "," );
+ if ( field == "styles" )
+ styles = value.split( "," );
+ if ( field == "format" )
+ format = value;
+ if ( field == "crs" )
+ crs = value;
}
- QgsDebugMsg ( "rasterLayerPath = " + rasterLayerPath );
- QgsDebugMsg ( "layers = " + layers.join(" " ) );
+ QgsDebugMsg( "rasterLayerPath = " + rasterLayerPath );
+ QgsDebugMsg( "layers = " + layers.join( " " ) );
mLayer = new QgsRasterLayer( 0, rasterLayerPath, "", providerKey, layers, styles, format, crs );
}
@@ -234,39 +240,39 @@ bool QgsBrowser::layerClicked(QgsLayerItem* ptr)
if ( !mLayer || !mLayer->isValid() )
{
- qDebug("No layer" );
+ qDebug( "No layer" );
return false;
}
- QgsDebugMsg ( "Layer created");
+ QgsDebugMsg( "Layer created" );
- QgsMapLayerRegistry::instance()->addMapLayer(mLayer);
+ QgsMapLayerRegistry::instance()->addMapLayer( mLayer );
return true;
}
-void QgsBrowser::itemDoubleClicked(const QModelIndex& index)
+void QgsBrowser::itemDoubleClicked( const QModelIndex& index )
{
- QgsDataItem* ptr = (QgsDataItem*) index.internalPointer();
+ QgsDataItem* ptr = ( QgsDataItem* ) index.internalPointer();
// Currently doing nothing
- qDebug("doubleclicked: %d %d %s", index.row(), index.column(), ptr->name().toAscii().data());
+ qDebug( "doubleclicked: %d %d %s", index.row(), index.column(), ptr->name().toAscii().data() );
}
-void QgsBrowser::itemExpanded(const QModelIndex& index)
+void QgsBrowser::itemExpanded( const QModelIndex& index )
{
- QSettings settings;
- QgsDataItem* ptr = (QgsDataItem*) index.internalPointer();
-/*
- if (ptr->mType == QgsDataItem::Directory || ptr->mType == QgsDataItem::Collection )
- {
- QgsDirectoryItem* i = (QgsDirectoryItem*) ptr;
- settings.setValue ( "/Browser/lastExpandedDir", i->mPath );
- }
-*/
+ QSettings settings;
+ QgsDataItem* ptr = ( QgsDataItem* ) index.internalPointer();
+ /*
+ if (ptr->mType == QgsDataItem::Directory || ptr->mType == QgsDataItem::Collection )
+ {
+ QgsDirectoryItem* i = (QgsDirectoryItem*) ptr;
+ settings.setValue ( "/Browser/lastExpandedDir", i->mPath );
+ }
+ */
// TODO: save separately each type (FS, WMS)
- settings.setValue ( "/Browser/lastExpanded", ptr->path() );
+ settings.setValue( "/Browser/lastExpanded", ptr->path() );
QgsDebugMsg( "last expanded: " + ptr->path() );
}
@@ -274,7 +280,7 @@ void QgsBrowser::newVectorLayer()
{
// Set file dialog to last selected dir
QSettings settings;
- QString lastPath = settings.value ( "/Browser/lastExpanded" ).toString();
+ QString lastPath = settings.value( "/Browser/lastExpanded" ).toString();
if ( !lastPath.isEmpty() )
{
settings.setValue( "/UI/lastVectorFileFilterDir", lastPath );
@@ -286,15 +292,15 @@ void QgsBrowser::newVectorLayer()
{
QgsDebugMsg( "New vector layer: " + fileName );
expand( fileName );
- QFileInfo fileInfo ( fileName );
+ QFileInfo fileInfo( fileName );
QString dirPath = fileInfo.absoluteDir().path();
- mModel->refresh ( dirPath );
+ mModel->refresh( dirPath );
}
}
void QgsBrowser::on_mActionWmsConnections_triggered()
{
- QDialog *wmss = dynamic_cast ( QgsProviderRegistry::instance()->getSelectWidget( QString("wms"), this ) );
+ QDialog *wmss = dynamic_cast( QgsProviderRegistry::instance()->selectWidget( QString( "wms" ), this ) );
if ( !wmss )
{
QMessageBox::warning( this, tr( "WMS" ), tr( "Cannot get WMS select dialog from provider." ) );
@@ -308,7 +314,8 @@ void QgsBrowser::on_mActionWmsConnections_triggered()
void QgsBrowser::on_mActionSetProjection_triggered()
{
- if ( !mLayer ) { return; }
+ if ( !mLayer )
+ return;
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector( this );
mySelector->setMessage();
mySelector->setSelectedCrsId( mLayer->crs().srsid() );
@@ -320,13 +327,13 @@ void QgsBrowser::on_mActionSetProjection_triggered()
// Is this safe?
// selectedIndexes() is protected
- QgsDataItem* ptr = (QgsDataItem*) mIndex.internalPointer();
+ QgsDataItem* ptr = ( QgsDataItem* ) mIndex.internalPointer();
if ( ptr->type() == QgsDataItem::Layer )
{
- QgsLayerItem* layerItem = static_cast(ptr);
- if ( ! layerItem->setCrs ( srs ) )
+ QgsLayerItem* layerItem = static_cast( ptr );
+ if ( ! layerItem->setCrs( srs ) )
{
- QMessageBox::critical( this, tr( "CRS" ), tr( "Cannot set layer CRS" ));
+ QMessageBox::critical( this, tr( "CRS" ), tr( "Cannot set layer CRS" ) );
}
}
QgsDebugMsg( srs.authid() + " - " + srs.description() );
@@ -365,14 +372,14 @@ void QgsBrowser::restoreWindowState()
QList sizes;
sizes << size0;
sizes << settings.value( "/Windows/Browser/sizes/1" ).toInt();
- QgsDebugMsg( QString("set splitter sizes to %1 %2").arg(sizes[0]).arg(sizes[1]) );
- splitter->setSizes(sizes);
+ QgsDebugMsg( QString( "set splitter sizes to %1 %2" ).arg( sizes[0] ).arg( sizes[1] ) );
+ splitter->setSizes( sizes );
}
}
void QgsBrowser::keyPressEvent( QKeyEvent * e )
{
- QgsDebugMsg( "Entered");
+ QgsDebugMsg( "Entered" );
if ( e->key() == Qt::Key_Escape )
{
stopRendering();
@@ -386,7 +393,7 @@ void QgsBrowser::keyPressEvent( QKeyEvent * e )
void QgsBrowser::stopRendering()
{
// you might have seen this already in QgisApp
- QgsDebugMsg( "Entered");
+ QgsDebugMsg( "Entered" );
if ( mapCanvas )
{
QgsMapRenderer* mypMapRenderer = mapCanvas->mapRenderer();
@@ -404,9 +411,9 @@ void QgsBrowser::stopRendering()
QgsBrowser::Tab QgsBrowser::activeTab()
{
QWidget* curr = tabWidget->currentWidget();
- if (curr == metaTab)
+ if ( curr == metaTab )
return Metadata;
- if (curr == previewTab)
+ if ( curr == previewTab )
return Preview;
return Attributes;
}
@@ -417,9 +424,9 @@ void QgsBrowser::updateCurrentTab()
Tab current = activeTab();
- if (current == Metadata && mDirtyMetadata)
+ if ( current == Metadata && mDirtyMetadata )
{
- if (mLayer && mLayer->isValid())
+ if ( mLayer && mLayer->isValid() )
{
// Set meta
QString myStyle = QgsApplication::reportStyleSheet();
@@ -429,33 +436,33 @@ void QgsBrowser::updateCurrentTab()
}
else
{
- metaTextBrowser->setHtml(QString());
+ metaTextBrowser->setHtml( QString() );
}
mDirtyMetadata = false;
}
- if (current == Preview && mDirtyPreview)
+ if ( current == Preview && mDirtyPreview )
{
- if (mLayer && mLayer->isValid())
+ if ( mLayer && mLayer->isValid() )
{
// Create preview: add to map canvas
QList layers;
- layers << QgsMapCanvasLayer(mLayer);
- mapCanvas->setLayerSet(layers);
+ layers << QgsMapCanvasLayer( mLayer );
+ mapCanvas->setLayerSet( layers );
QgsRectangle fullExtent = mLayer->extent();
- fullExtent.scale(1.05); // add some border
- mapCanvas->setExtent(fullExtent);
+ fullExtent.scale( 1.05 ); // add some border
+ mapCanvas->setExtent( fullExtent );
mapCanvas->refresh();
}
mDirtyPreview = false;
}
- if (current == Attributes && mDirtyAttributes)
+ if ( current == Attributes && mDirtyAttributes )
{
if ( mLayer && mLayer->isValid() && mLayer->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer* vlayer = qobject_cast( mLayer );
- QApplication::setOverrideCursor(Qt::WaitCursor);
+ QApplication::setOverrideCursor( Qt::WaitCursor );
attributeTable->setLayer( vlayer );
QApplication::restoreOverrideCursor();
}
@@ -471,11 +478,11 @@ void QgsBrowser::tabChanged()
{
updateCurrentTab();
// Store last selected tab for selected data item
- if ( mIndex.isValid() )
+ if ( mIndex.isValid() )
{
- QObject* ptr = (QObject*) mIndex.internalPointer();
- QgsDebugMsg( QString("save last tab %1 : %2").arg( typeid(*ptr).name() ).arg(tabWidget->currentIndex()) );
- mLastTab[typeid(*ptr).name()] = tabWidget->currentIndex();
+ QObject* ptr = ( QObject* ) mIndex.internalPointer();
+ QgsDebugMsg( QString( "save last tab %1 : %2" ).arg( ptr->metaObject()->className() ).arg( tabWidget->currentIndex() ) );
+ mLastTab[ ptr->metaObject()->className() ] = tabWidget->currentIndex();
}
}
@@ -488,16 +495,16 @@ void QgsBrowser::on_mActionRefresh_triggered()
void QgsBrowser::refresh( const QModelIndex& index )
{
QgsDebugMsg( "Entered" );
- if ( index.isValid() )
+ if ( index.isValid() )
{
- QgsDataItem* item = (QgsDataItem*) index.internalPointer();
+ QgsDataItem* item = ( QgsDataItem* ) index.internalPointer();
QgsDebugMsg( "path = " + item->path() );
}
mModel->refresh( index );
- for ( int i = 0 ; i < mModel->rowCount(index); i++ )
+ for ( int i = 0 ; i < mModel->rowCount( index ); i++ )
{
- QModelIndex idx = mModel->index(i, 0, index);
- if ( treeView->isExpanded ( idx ) )
+ QModelIndex idx = mModel->index( i, 0, index );
+ if ( treeView->isExpanded( idx ) )
{
refresh( idx );
}
diff --git a/src/browser/qgsbrowser.h b/src/browser/qgsbrowser.h
index 318218565d8..a54d75746db 100644
--- a/src/browser/qgsbrowser.h
+++ b/src/browser/qgsbrowser.h
@@ -35,14 +35,14 @@ class QgsBrowser : public QMainWindow, private Ui::QgsBrowserBase
~QgsBrowser();
// Expand to given path
- void expand ( QString path, const QModelIndex& index = QModelIndex() );
+ void expand( QString path, const QModelIndex& index = QModelIndex() );
public slots:
- void itemClicked(const QModelIndex& index);
- void itemDoubleClicked(const QModelIndex& index);
- void itemExpanded(const QModelIndex& index);
+ void itemClicked( const QModelIndex& index );
+ void itemDoubleClicked( const QModelIndex& index );
+ void itemExpanded( const QModelIndex& index );
void on_mActionSetProjection_triggered();
void on_mActionWmsConnections_triggered();
void on_mActionRefresh_triggered();
@@ -56,12 +56,12 @@ class QgsBrowser : public QMainWindow, private Ui::QgsBrowserBase
void stopRendering();
// Refresh all leaf or expanded items
- void refresh ( const QModelIndex& index= QModelIndex() );
+ void refresh( const QModelIndex& index = QModelIndex() );
-protected:
+ protected:
void keyPressEvent( QKeyEvent * e );
- bool layerClicked(QgsLayerItem* ptr);
+ bool layerClicked( QgsLayerItem* ptr );
enum Tab
{
@@ -78,7 +78,7 @@ protected:
QModelIndex mIndex;
QWidget *mParamWidget;
// last (selected) tab for each
- QMap mLastTab;
+ QMap mLastTab;
};
#endif // QGSBROWSER_H
diff --git a/src/browser/qgsbrowsermodel.cpp b/src/browser/qgsbrowsermodel.cpp
index bcd33f2ad1b..c940151286e 100755
--- a/src/browser/qgsbrowsermodel.cpp
+++ b/src/browser/qgsbrowsermodel.cpp
@@ -31,8 +31,9 @@ QgsBrowserModel::QgsBrowserModel( QObject *parent ) :
// Add non file top level items
foreach( QString key, QgsProviderRegistry::instance()->providerList() )
{
- QLibrary *library = QgsProviderRegistry::instance()->getLibrary( key );
- if ( !library ) continue;
+ QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
+ if ( !library )
+ continue;
dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
if ( !dataCapabilities )
@@ -277,7 +278,8 @@ void QgsBrowserModel::beginInsertItems( QgsDataItem* parent, int first, int last
{
QgsDebugMsg( "parent mPath = " + parent->path() );
QModelIndex idx = index( parent );
- if ( !idx.isValid() ) return;
+ if ( !idx.isValid() )
+ return;
QgsDebugMsg( "valid" );
beginInsertRows( idx, first, last );
QgsDebugMsg( "end" );
@@ -291,7 +293,8 @@ void QgsBrowserModel::beginRemoveItems( QgsDataItem* parent, int first, int last
{
QgsDebugMsg( "parent mPath = " + parent->path() );
QModelIndex idx = index( parent );
- if ( !idx.isValid() ) return;
+ if ( !idx.isValid() )
+ return;
beginRemoveRows( idx, first, last );
}
void QgsBrowserModel::endRemoveItems()
diff --git a/src/browser/qgsbrowsermodel.h b/src/browser/qgsbrowsermodel.h
index 106188add5c..19c5bad5fa3 100644
--- a/src/browser/qgsbrowsermodel.h
+++ b/src/browser/qgsbrowsermodel.h
@@ -9,8 +9,8 @@
class QgsBrowserModel : public QAbstractItemModel
{
Q_OBJECT
-public:
- explicit QgsBrowserModel(QObject *parent = 0);
+ public:
+ explicit QgsBrowserModel( QObject *parent = 0 );
~QgsBrowserModel();
// implemented methods from QAbstractItemModel for read-only access
@@ -31,7 +31,7 @@ public:
virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
/** Provides the number of columns of data exposed by the model. List models do not provide this function
because it is already implemented in QAbstractListModel. */
- virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
+ virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const;
/** Returns the index of the item in the model specified by the given row, column and parent index. */
virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
@@ -42,17 +42,17 @@ public:
virtual QModelIndex parent( const QModelIndex & index ) const;
- bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
+ bool hasChildren( const QModelIndex & parent = QModelIndex() ) const;
// Refresh item specified by path
void refresh( QString path, const QModelIndex& index = QModelIndex() );
// Refresh item childs
void refresh( const QModelIndex& index = QModelIndex() );
- void connectItem ( QgsDataItem * item );
-signals:
+ void connectItem( QgsDataItem * item );
+ signals:
-public slots:
+ public slots:
//void removeItems( QgsDataItem * parent, QVectoritems );
//void addItems( QgsDataItem * parent, QVectoritems );
//void refreshItems( QgsDataItem * parent, QVectoritems );
@@ -62,7 +62,7 @@ public slots:
void beginRemoveItems( QgsDataItem* parent, int first, int last );
void endRemoveItems();
-protected:
+ protected:
QVector mRootItems;
QIcon mIconDirectory;
};
diff --git a/src/core/pal/rtree.hpp b/src/core/pal/rtree.hpp
index 2c7310ebe77..757fef85ccc 100644
--- a/src/core/pal/rtree.hpp
+++ b/src/core/pal/rtree.hpp
@@ -1079,7 +1079,7 @@ namespace pal
{
ASSERT( a_rectA && a_rectB );
- Rect newRect = { {0,}, {0,} };
+ Rect newRect = { {0, }, {0, } };
for ( int index = 0; index < NUMDIMS; ++index )
{
diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp
index 90ecb705b1b..4ac0f0993db 100644
--- a/src/core/qgsapplication.cpp
+++ b/src/core/qgsapplication.cpp
@@ -115,7 +115,8 @@ bool QgsApplication::notify( QObject * receiver, QEvent * event )
bool done = false;
emit preNotify( receiver, event, &done );
- if ( done ) return true;
+ if ( done )
+ return true;
// Send event to receiver and catch unhandled exceptions
done = true;
diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp
index 509b65f38d2..34780b52c2c 100644
--- a/src/core/qgscoordinatereferencesystem.cpp
+++ b/src/core/qgscoordinatereferencesystem.cpp
@@ -104,8 +104,10 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString theDefinition
{
QString authName = reCrsId.cap( 1 ).toLower();
CrsType type = InternalCrsId;
- if ( authName == "epsg" ) type = EpsgCrsId;
- if ( authName == "postgis" ) type = PostgisCrsId;
+ if ( authName == "epsg" )
+ type = EpsgCrsId;
+ if ( authName == "postgis" )
+ type = PostgisCrsId;
long id = reCrsId.cap( 2 ).toLong();
result = createFromId( id, type );
}
diff --git a/src/core/qgscoordinatetransform.cpp b/src/core/qgscoordinatetransform.cpp
index 6e6b519c6dc..a70a41fd009 100644
--- a/src/core/qgscoordinatetransform.cpp
+++ b/src/core/qgscoordinatetransform.cpp
@@ -222,7 +222,8 @@ void QgsCoordinateTransform::initialise()
QgsPoint QgsCoordinateTransform::transform( const QgsPoint thePoint, TransformDirection direction ) const
{
- if ( mShortCircuit || !mInitialisedFlag ) return thePoint;
+ if ( mShortCircuit || !mInitialisedFlag )
+ return thePoint;
// transform x
double x = thePoint.x();
double y = thePoint.y();
@@ -258,7 +259,8 @@ QgsPoint QgsCoordinateTransform::transform( const double theX, const double theY
QgsRectangle QgsCoordinateTransform::transform( const QgsRectangle theRect, TransformDirection direction ) const
{
- if ( mShortCircuit || !mInitialisedFlag ) return theRect;
+ if ( mShortCircuit || !mInitialisedFlag )
+ return theRect;
// transform x
double x1 = theRect.xMinimum();
double y1 = theRect.yMinimum();
diff --git a/src/core/qgsdataitem.cpp b/src/core/qgsdataitem.cpp
index 797b04413ff..ced6c049c27 100755
--- a/src/core/qgsdataitem.cpp
+++ b/src/core/qgsdataitem.cpp
@@ -166,7 +166,8 @@ void QgsDataItem::populate()
int QgsDataItem::rowCount()
{
- if ( !mPopulated ) populate();
+ if ( !mPopulated )
+ populate();
return mChildren.size();
}
bool QgsDataItem::hasChildren()
@@ -180,10 +181,13 @@ void QgsDataItem::addChildItem( QgsDataItem * child, bool refresh )
int i;
for ( i = 0; i < mChildren.size(); i++ )
{
- if ( mChildren[i]->mName.localeAwareCompare( child->mName ) >= 0 ) break;
+ if ( mChildren[i]->mName.localeAwareCompare( child->mName ) >= 0 )
+ break;
}
- if ( refresh ) emit beginInsertItems( this, i, i );
+ if ( refresh )
+ emit beginInsertItems( this, i, i );
+
mChildren.insert( i, child );
connect( child, SIGNAL( beginInsertItems( QgsDataItem*, int, int ) ),
@@ -195,8 +199,8 @@ void QgsDataItem::addChildItem( QgsDataItem * child, bool refresh )
connect( child, SIGNAL( endRemoveItems() ),
this, SLOT( emitEndRemoveItems() ) );
- if ( refresh ) emit endInsertItems();
-
+ if ( refresh )
+ emit endInsertItems();
}
void QgsDataItem::deleteChildItem( QgsDataItem * child )
{
@@ -214,7 +218,8 @@ int QgsDataItem::findItem( QVector items, QgsDataItem * item )
for ( int i = 0; i < items.size(); i++ )
{
QgsDebugMsg( QString::number( i ) + " : " + items[i]->mPath + " x " + item->mPath );
- if ( items[i]->equal( item ) ) return i;
+ if ( items[i]->equal( item ) )
+ return i;
}
return -1;
}
@@ -229,7 +234,8 @@ void QgsDataItem::refresh()
QVector remove;
foreach( QgsDataItem *child, mChildren )
{
- if ( findItem( items, child ) >= 0 ) continue;
+ if ( findItem( items, child ) >= 0 )
+ continue;
remove.append( child );
}
foreach( QgsDataItem *child, remove )
@@ -280,7 +286,8 @@ QgsLayerItem::QgsLayerItem( QgsDataItem* parent, QString name, QString path, QSt
QgsMapLayer::LayerType QgsLayerItem::mapLayerType()
{
- if ( mLayerType == QgsLayerItem::Raster ) return QgsMapLayer::RasterLayer;
+ if ( mLayerType == QgsLayerItem::Raster )
+ return QgsMapLayer::RasterLayer;
return QgsMapLayer::VectorLayer;
}
@@ -328,7 +335,7 @@ QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, QString name, QString p
QString k( *i );
// some providers hangs with empty uri (Postgis) etc...
// -> using libraries directly
- QLibrary *library = QgsProviderRegistry::instance()->getLibrary( k );
+ QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( k );
if ( library )
{
dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
@@ -384,7 +391,10 @@ QVector QgsDirectoryItem::createChildren( )
// TODO: use existing fileVectorFilters(),directoryDrivers() ?
dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
- if ( !dataCapabilities ) continue;
+ if ( !dataCapabilities )
+ {
+ continue;
+ }
int capabilities = dataCapabilities();
diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp
index 4b8c21d86f6..069e5104cec 100644
--- a/src/core/qgsdistancearea.cpp
+++ b/src/core/qgsdistancearea.cpp
@@ -667,7 +667,8 @@ void QgsDistanceArea::computeAreaInit()
m_Qp = getQ( M_PI / 2 );
m_E = 4 * M_PI * m_Qp * m_AE;
- if ( m_E < 0.0 ) m_E = -m_E;
+ if ( m_E < 0.0 )
+ m_E = -m_E;
}
@@ -720,8 +721,10 @@ double QgsDistanceArea::computePolygonArea( const QList& points )
* the difference between total surface area of the earth and
* the "north pole" area.
*/
- if ( area > m_E ) area = m_E;
- if ( area > m_E / 2 ) area = m_E - area;
+ if ( area > m_E )
+ area = m_E;
+ if ( area > m_E / 2 )
+ area = m_E - area;
return area;
}
diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h
index c2833922dbb..21956106b24 100644
--- a/src/core/qgsmaplayer.h
+++ b/src/core/qgsmaplayer.h
@@ -334,7 +334,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
/** \brief Obtain Metadata for this layer */
virtual QString metadata();
-
+
/** Time stamp of data source in the moment when data/metadata were loaded by provider */
virtual QDateTime timestamp() const { return QDateTime() ; }
diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp
index 7a710155af3..cab7cf79e75 100644
--- a/src/core/qgspallabeling.cpp
+++ b/src/core/qgspallabeling.cpp
@@ -62,7 +62,8 @@ class QgsPalGeometry : public PalGeometry
~QgsPalGeometry()
{
- if ( mG ) GEOSGeom_destroy( mG );
+ if ( mG )
+ GEOSGeom_destroy( mG );
delete mInfo;
}
@@ -82,7 +83,8 @@ class QgsPalGeometry : public PalGeometry
pal::LabelInfo* info( QFontMetricsF* fm, const QgsMapToPixel* xform, double fontScale )
{
- if ( mInfo ) return mInfo;
+ if ( mInfo )
+ return mInfo;
// create label info!
QgsPoint ptZero = xform->toMapCoordinates( 0, 0 );
@@ -714,7 +716,7 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet& attrIndices,
case QgsPalLayerSettings::Curved: arrangement = P_CURVED; break;
case QgsPalLayerSettings::Horizontal: arrangement = P_HORIZ; break;
case QgsPalLayerSettings::Free: arrangement = P_FREE; break;
- default: Q_ASSERT( "unsupported placement" && 0 ); return 0; break;
+ default: Q_ASSERT( "unsupported placement" && 0 ); return 0;
}
// create the pal layer
diff --git a/src/core/qgsproviderregistry.cpp b/src/core/qgsproviderregistry.cpp
index 74b3befb938..c356d5c4b75 100644
--- a/src/core/qgsproviderregistry.cpp
+++ b/src/core/qgsproviderregistry.cpp
@@ -331,8 +331,7 @@ typedef QgsDataProvider * classFactoryFunction_t( const QString * );
* It seems more sensible to provide the code in one place rather than
* in qgsrasterlayer, qgsvectorlayer, serversourceselect, etc.
*/
-QgsDataProvider* QgsProviderRegistry::getProvider( QString const & providerKey,
- QString const & dataSource )
+QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QString const & dataSource )
{
// XXX should I check for and possibly delete any pre-existing providers?
// XXX How often will that scenario occur?
@@ -430,24 +429,25 @@ QgsDataProvider* QgsProviderRegistry::getProvider( QString const & providerKey,
// This should be QWidget, not QDialog
typedef QWidget * selectFactoryFunction_t( QWidget * parent, Qt::WFlags fl );
-QWidget* QgsProviderRegistry::getSelectWidget( const QString & providerKey,
- QWidget * parent, Qt::WFlags fl )
+QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey,
+ QWidget * parent, Qt::WFlags fl )
{
- QLibrary *myLib = getLibrary( providerKey );
- if ( !myLib ) return 0;
+ QLibrary *myLib = providerLibrary( providerKey );
+ if ( !myLib )
+ return 0;
selectFactoryFunction_t * selectFactory =
( selectFactoryFunction_t * ) cast_to_fptr( myLib->resolve( "selectWidget" ) );
- if ( !selectFactory ) return 0;
+ if ( !selectFactory )
+ return 0;
- QWidget *widget = ( *selectFactory )( parent, fl );
- return widget;
+ return selectFactory( parent, fl );
}
-
-void * QgsProviderRegistry::getFunction( QString const & providerKey,
- QString const & functionName )
+
+void * QgsProviderRegistry::function( QString const & providerKey,
+ QString const & functionName )
{
QString lib = library( providerKey );
@@ -467,20 +467,20 @@ void * QgsProviderRegistry::getFunction( QString const & providerKey,
return 0;
}
-QLibrary * QgsProviderRegistry::getLibrary( QString const & providerKey )
+QLibrary *QgsProviderRegistry::providerLibrary( QString const & providerKey )
{
QString lib = library( providerKey );
- QLibrary* myLib = new QLibrary( lib );
+ QLibrary *myLib = new QLibrary( lib );
QgsDebugMsg( "Library name is " + myLib->fileName() );
bool loaded = myLib->load();
-
+
if ( loaded )
{
return myLib;
- }
+ }
delete myLib;
return 0;
}
diff --git a/src/core/qgsproviderregistry.h b/src/core/qgsproviderregistry.h
index be191df8b4f..bcb15d74932 100644
--- a/src/core/qgsproviderregistry.h
+++ b/src/core/qgsproviderregistry.h
@@ -65,21 +65,21 @@ class CORE_EXPORT QgsProviderRegistry
@param dataSource string containing data source for the provider
@return instance of provider or NULL on error
*/
- QgsDataProvider * getProvider( const QString & providerKey,
- const QString & dataSource );
+ QgsDataProvider *provider( const QString & providerKey,
+ const QString & dataSource );
- QWidget * getSelectWidget ( const QString & providerKey,
- QWidget * parent=0, Qt::WFlags fl=0 );
+ QWidget *selectWidget( const QString & providerKey,
+ QWidget * parent = 0, Qt::WFlags fl = 0 );
/** Get pointer to provider function
@param providerKey identificator of the provider
@param functionName name of function
@return pointer to function or NULL on error
*/
- void * getFunction( const QString & providerKey,
- const QString & functionName );
+ void *function( const QString & providerKey,
+ const QString & functionName );
- QLibrary * getLibrary ( const QString & providerKey );
+ QLibrary *providerLibrary( const QString & providerKey );
/** Return list of available providers by their keys */
QStringList providerList() const;
diff --git a/src/core/qgspythonrunner.cpp b/src/core/qgspythonrunner.cpp
index 951d2f2ca4a..46a822284e9 100644
--- a/src/core/qgspythonrunner.cpp
+++ b/src/core/qgspythonrunner.cpp
@@ -19,7 +19,7 @@ bool QgsPythonRunner::run( QString command, QString messageOnError )
}
else
{
- QgsDebugMsg("Unable to run Python command: runner not available!");
+ QgsDebugMsg( "Unable to run Python command: runner not available!" );
return false;
}
}
diff --git a/src/core/qgspythonrunner.h b/src/core/qgspythonrunner.h
index 4933bd12bf4..f5158466c8e 100644
--- a/src/core/qgspythonrunner.h
+++ b/src/core/qgspythonrunner.h
@@ -14,7 +14,7 @@
*/
class CORE_EXPORT QgsPythonRunner
{
-public:
+ public:
/** returns true if the runner has an instance
(and thus is able to run commands) */
@@ -28,7 +28,7 @@ public:
Takes ownership of the object, deletes previous instance. */
static void setInstance( QgsPythonRunner* runner );
-protected:
+ protected:
/** protected constructor: can be instantiated only from children */
QgsPythonRunner();
virtual ~QgsPythonRunner();
diff --git a/src/core/qgsrasterdataprovider.cpp b/src/core/qgsrasterdataprovider.cpp
index b707fe6df30..e3d5727037a 100644
--- a/src/core/qgsrasterdataprovider.cpp
+++ b/src/core/qgsrasterdataprovider.cpp
@@ -54,7 +54,8 @@ void QgsRasterDataProvider::readBlock( int bandNo, QgsRectangle const & viewExt
// TODO: init data by nulls
// If we zoom out too much, projector srcRows / srcCols maybe 0, which can cause problems in providers
- if ( myProjector.srcRows() <= 0 || myProjector.srcCols() <= 0 ) return;
+ if ( myProjector.srcRows() <= 0 || myProjector.srcCols() <= 0 )
+ return;
// Allocate memory for not projected source data
int mySize = dataTypeSize( bandNo ) / 8;
diff --git a/src/core/qgsrasterprojector.cpp b/src/core/qgsrasterprojector.cpp
index f54c3412189..d9d6df6f524 100644
--- a/src/core/qgsrasterprojector.cpp
+++ b/src/core/qgsrasterprojector.cpp
@@ -16,8 +16,6 @@
***************************************************************************/
/* $Id: qgsrasterprojector.cpp 15005 2011-01-08 16:35:21Z rblazek $ */
-#include
-
#include "qgslogger.h"
#include "qgsrasterprojector.h"
#include "qgscoordinatetransform.h"
@@ -176,10 +174,12 @@ QString QgsRasterProjector::cpToString()
QString myString;
for ( int i = 0; i < mCPRows; i++ )
{
- if ( i > 0 ) myString += "\n";
+ if ( i > 0 )
+ myString += "\n";
for ( int j = 0; j < mCPCols; j++ )
{
- if ( j > 0 ) myString += " ";
+ if ( j > 0 )
+ myString += " ";
QgsPoint myPoint = mCPMatrix[i][j];
myString += myPoint.toString();
}
@@ -210,10 +210,12 @@ void QgsRasterProjector::calcSrcRowsCols()
QgsPoint myPointB = mCPMatrix[i][j+1];
QgsPoint myPointC = mCPMatrix[i+1][j];
double mySize = sqrt( myPointA.sqrDist( myPointB ) ) / myDestColsPerMatrixCell;
- if ( mySize < myMinSize ) { myMinSize = mySize; }
+ if ( mySize < myMinSize )
+ myMinSize = mySize;
mySize = sqrt( myPointA.sqrDist( myPointC ) ) / myDestRowsPerMatrixCell;
- if ( mySize < myMinSize ) { myMinSize = mySize; }
+ if ( mySize < myMinSize )
+ myMinSize = mySize;
}
}
@@ -294,7 +296,8 @@ void QgsRasterProjector::nextHelper()
void QgsRasterProjector::srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol )
{
- if ( mApproximate ) approximateSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
+ if ( mApproximate )
+ approximateSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
else preciseSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
}
@@ -321,13 +324,17 @@ void QgsRasterProjector::preciseSrcRowCol( int theDestRow, int theDestCol, int *
// With epsg 32661 (Polar Stereographic) it was happening that *theSrcCol == mSrcCols
// For now silently correct limits to avoid crashes
// TODO: review
- if ( *theSrcRow >= mSrcRows ) *theSrcRow = mSrcRows - 1;
- if ( *theSrcRow < 0 ) *theSrcRow = 0;
- if ( *theSrcCol >= mSrcCols ) *theSrcCol = mSrcCols - 1;
- if ( *theSrcCol < 0 ) *theSrcCol = 0;
+ if ( *theSrcRow >= mSrcRows )
+ *theSrcRow = mSrcRows - 1;
+ if ( *theSrcRow < 0 )
+ *theSrcRow = 0;
+ if ( *theSrcCol >= mSrcCols )
+ *theSrcCol = mSrcCols - 1;
+ if ( *theSrcCol < 0 )
+ *theSrcCol = 0;
- assert( *theSrcRow < mSrcRows );
- assert( *theSrcCol < mSrcCols );
+ Q_ASSERT( *theSrcRow < mSrcRows );
+ Q_ASSERT( *theSrcCol < mSrcCols );
}
void QgsRasterProjector::approximateSrcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol )
@@ -373,12 +380,16 @@ void QgsRasterProjector::approximateSrcRowCol( int theDestRow, int theDestCol, i
// For now silently correct limits to avoid crashes
// TODO: review
- if ( *theSrcRow >= mSrcRows ) *theSrcRow = mSrcRows - 1;
- if ( *theSrcRow < 0 ) *theSrcRow = 0;
- if ( *theSrcCol >= mSrcCols ) *theSrcCol = mSrcCols - 1;
- if ( *theSrcCol < 0 ) *theSrcCol = 0;
- assert( *theSrcRow < mSrcRows );
- assert( *theSrcCol < mSrcCols );
+ if ( *theSrcRow >= mSrcRows )
+ *theSrcRow = mSrcRows - 1;
+ if ( *theSrcRow < 0 )
+ *theSrcRow = 0;
+ if ( *theSrcCol >= mSrcCols )
+ *theSrcCol = mSrcCols - 1;
+ if ( *theSrcCol < 0 )
+ *theSrcCol = 0;
+ Q_ASSERT( *theSrcRow < mSrcRows );
+ Q_ASSERT( *theSrcCol < mSrcCols );
}
void QgsRasterProjector::insertRows()
@@ -466,7 +477,8 @@ bool QgsRasterProjector::checkCols()
QgsPoint mySrcApprox(( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 );
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
- if ( mySqrDist > mSqrTolerance ) { return false; }
+ if ( mySqrDist > mSqrTolerance )
+ return false;
}
}
return true;
@@ -489,7 +501,8 @@ bool QgsRasterProjector::checkRows()
QgsPoint mySrcApprox(( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 );
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
- if ( mySqrDist > mSqrTolerance ) { return false; }
+ if ( mySqrDist > mSqrTolerance )
+ return false;
}
}
return true;
diff --git a/src/core/qgsrasterprojector.h b/src/core/qgsrasterprojector.h
index 60e29032184..61c6b73ce02 100644
--- a/src/core/qgsrasterprojector.h
+++ b/src/core/qgsrasterprojector.h
@@ -200,7 +200,7 @@ class QgsRasterProjector
/** Maximum source resolution */
double mMaxSrcXRes;
double mMaxSrcYRes;
-
+
/** Use approximation */
bool mApproximate;
};
diff --git a/src/core/qgsrectangle.cpp b/src/core/qgsrectangle.cpp
index 289f2c3c9a7..b322c4271fe 100644
--- a/src/core/qgsrectangle.cpp
+++ b/src/core/qgsrectangle.cpp
@@ -150,10 +150,12 @@ bool QgsRectangle::intersects( const QgsRectangle& rect ) const
{
double x1 = ( xmin > rect.xmin ? xmin : rect.xmin );
double x2 = ( xmax < rect.xmax ? xmax : rect.xmax );
- if ( x1 > x2 ) return false;
+ if ( x1 > x2 )
+ return false;
double y1 = ( ymin > rect.ymin ? ymin : rect.ymin );
double y2 = ( ymax < rect.ymax ? ymax : rect.ymax );
- if ( y1 > y2 ) return false;
+ if ( y1 > y2 )
+ return false;
return true;
}
@@ -300,10 +302,14 @@ QgsRectangle & QgsRectangle::operator=( const QgsRectangle & r )
void QgsRectangle::unionRect( const QgsRectangle& r )
{
- if ( r.xMinimum() < xMinimum() ) setXMinimum( r.xMinimum() );
- if ( r.xMaximum() > xMaximum() ) setXMaximum( r.xMaximum() );
- if ( r.yMinimum() < yMinimum() ) setYMinimum( r.yMinimum() );
- if ( r.yMaximum() > yMaximum() ) setYMaximum( r.yMaximum() );
+ if ( r.xMinimum() < xMinimum() )
+ setXMinimum( r.xMinimum() );
+ if ( r.xMaximum() > xMaximum() )
+ setXMaximum( r.xMaximum() );
+ if ( r.yMinimum() < yMinimum() )
+ setYMinimum( r.yMinimum() );
+ if ( r.yMaximum() > yMaximum() )
+ setYMaximum( r.yMaximum() );
}
bool QgsRectangle::isFinite() const
diff --git a/src/core/qgssearchtreenode.cpp b/src/core/qgssearchtreenode.cpp
index a99d3028be4..ae0a8ee6621 100644
--- a/src/core/qgssearchtreenode.cpp
+++ b/src/core/qgssearchtreenode.cpp
@@ -644,19 +644,24 @@ QgsSearchTreeValue QgsSearchTreeNode::valueAgainst( const QgsFieldMap& fields, Q
{
if ( mLeft->type() != tNodeList )
{
- if ( !getValue( value1, mLeft, fields, f ) ) return value1;
+ if ( !getValue( value1, mLeft, fields, f ) )
+ return value1;
}
else
{
- if ( mLeft->mNodeList.size() > 0 && !getValue( value1, mLeft->mNodeList[0], fields, f ) ) return value1;
- if ( mLeft->mNodeList.size() > 1 && !getValue( value2, mLeft->mNodeList[1], fields, f ) ) return value2;
- if ( mLeft->mNodeList.size() > 2 && !getValue( value3, mLeft->mNodeList[2], fields, f ) ) return value3;
+ if ( mLeft->mNodeList.size() > 0 && !getValue( value1, mLeft->mNodeList[0], fields, f ) )
+ return value1;
+ if ( mLeft->mNodeList.size() > 1 && !getValue( value2, mLeft->mNodeList[1], fields, f ) )
+ return value2;
+ if ( mLeft->mNodeList.size() > 2 && !getValue( value3, mLeft->mNodeList[2], fields, f ) )
+ return value3;
}
}
if ( mRight )
{
Q_ASSERT( !mLeft || mLeft->type() != tNodeList );
- if ( !getValue( value2, mRight, fields, f ) ) return value2;
+ if ( !getValue( value2, mRight, fields, f ) )
+ return value2;
}
if ( mOp == opLENGTH || mOp == opAREA || mOp == opPERIMETER || mOp == opX || mOp == opY )
diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp
index e0b38a87e44..b3025ca54a6 100644
--- a/src/core/qgsvectorlayer.cpp
+++ b/src/core/qgsvectorlayer.cpp
@@ -2711,7 +2711,7 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
//XXX - This was a dynamic cast but that kills the Windows
// version big-time with an abnormal termination error
mDataProvider =
- ( QgsVectorDataProvider* )( QgsProviderRegistry::instance()->getProvider( provider, mDataSource ) );
+ ( QgsVectorDataProvider* )( QgsProviderRegistry::instance()->provider( provider, mDataSource ) );
if ( mDataProvider )
{
@@ -2902,11 +2902,15 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
if ( returnCode == 1 )
{
- errorMessage = tr( "No renderer object" ); delete renderer; return false;
+ errorMessage = tr( "No renderer object" );
+ delete renderer;
+ return false;
}
else if ( returnCode == 2 )
{
- errorMessage = tr( "Classification field not found" ); delete renderer; return false;
+ errorMessage = tr( "Classification field not found" );
+ delete renderer;
+ return false;
}
mRenderer = renderer;
@@ -5514,7 +5518,7 @@ QString QgsVectorLayer::metadata()
myMetadata += "