Skip to content

Commit 4549d0e

Browse files
committed
cleanups:
- use QMetaObject instead of RTTI - no get in getters: - QgsDataProvider: - getProvider => provider - getSelectWidget => selectWidget - getFunction => function - getLibary => providerLibrary - QgsProviderRegistry: - getLibrary => providerLibrary - /* ... */ => #if 0 / #endif - reindentation
1 parent ee6c516 commit 4549d0e

File tree

116 files changed

+4071
-3488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+4071
-3488
lines changed

python/core/qgsproviderregistry.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QgsProviderRegistry
2626

2727
void setLibraryDirectory(const QDir & path);
2828

29-
QgsDataProvider * getProvider( const QString & providerKey,
29+
QgsDataProvider *provider( const QString & providerKey,
3030
const QString & dataSource );
3131

3232
/** Return list of available providers by their keys */

scripts/astyle-all.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ export elcr="$(tput el)$(tput cr)"
88

99
find src -type f -print | while read f; do
1010
case "$f" in
11-
src/core/spatialite/*)
12-
continue
13-
;;
14-
11+
src/core/spatialite/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
12+
echo $f skipped
13+
continue
14+
;;
1515

16-
*.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H)
16+
*.cpp|*.h|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H|*.hpp)
1717
cmd=astyle.sh
1818
;;
1919

20-
*.ui|*.qgm|*.txt|*.t2t|*.py|*.sip|resources/context_help/*)
21-
cmd="flip -ub"
22-
;;
23-
20+
*.ui|*.qgm|*.txt|*.t2t|*.py|*.sip|resources/context_help/*)
21+
cmd="flip -ub"
22+
;;
2423

2524
*)
25+
echo $f skipped
2626
continue
2727
;;
2828
esac

src/analysis/interpolation/DualEdgeTriangulation.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,6 @@ void DualEdgeTriangulation::ruppertRefinement()
19791979

19801980
}
19811981
while ( actedge != pointingedge );
1982-
19831982
}
19841983
}
19851984
}
@@ -2190,9 +2189,6 @@ void DualEdgeTriangulation::ruppertRefinement()
21902189

21912190
}
21922191
while ( actedge != pointingedge );
2193-
2194-
2195-
21962192
}
21972193
} //end fast method
21982194

@@ -2407,7 +2403,6 @@ void DualEdgeTriangulation::ruppertRefinement()
24072403

24082404
}
24092405
while ( actedge != pointingedge );
2410-
24112406
}
24122407
}
24132408

src/analysis/interpolation/ParametricLine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <QVector>
2323

2424
class ANALYSIS_EXPORT ParametricLine
25-
/**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.*/
25+
/**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.*/
2626
{
2727
protected:
2828
/**Degree of the parametric Line*/

src/app/attributetable/qgsattributetabledialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
137137
connect( mView->verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( updateRowPressed( int ) ) );
138138
connect( mModel, SIGNAL( modelChanged() ), this, SLOT( updateSelection() ) );
139139

140-
connect( mView, SIGNAL(willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT(viewWillShowContextMenu(QMenu*, QModelIndex ) ) );
140+
connect( mView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) );
141141

142142
mLastClickedHeaderIndex = 0;
143143
mSelectionModel = new QItemSelectionModel( mFilterModel );

src/app/composer/qgscomposer.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
499499

500500
int result = myQFileDialog->exec();
501501
raise();
502-
if ( result != QDialog::Accepted ) return;
502+
if ( result != QDialog::Accepted )
503+
return;
503504

504505
QString myOutputFileNameQString = myQFileDialog->selectedFiles().first();
505506
if ( myOutputFileNameQString == "" )
@@ -666,7 +667,8 @@ void QgsComposer::on_mActionExportAsImage_triggered()
666667
QString myFilter = tr( "%1 format (*.%2 *.%3)" )
667668
.arg( myFormat ).arg( myFormat.toLower() ).arg( myFormat.toUpper() );
668669

669-
if ( myCounterInt > 0 ) myFilters += ";;";
670+
if ( myCounterInt > 0 )
671+
myFilters += ";;";
670672
myFilters += myFilter;
671673
myFilterMap[myFilter] = myFormat;
672674
if ( myFormat == myLastUsedFormat )
@@ -799,7 +801,8 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
799801

800802
int result = myQFileDialog->exec();
801803
raise();
802-
if ( result != QDialog::Accepted ) return;
804+
if ( result != QDialog::Accepted )
805+
return;
803806

804807
QString myOutputFileNameQString = myQFileDialog->selectedFiles().first();
805808
if ( myOutputFileNameQString == "" )

src/app/composer/qgscomposermapwidget.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,17 @@ void QgsComposerMapWidget::updateComposerExtentFromGui()
402402
bool conversionSuccess;
403403

404404
xmin = mXMinLineEdit->text().toDouble( &conversionSuccess );
405-
if ( !conversionSuccess ) {return;}
405+
if ( !conversionSuccess )
406+
return;
406407
xmax = mXMaxLineEdit->text().toDouble( &conversionSuccess );
407-
if ( !conversionSuccess ) {return;}
408+
if ( !conversionSuccess )
409+
return;
408410
ymin = mYMinLineEdit->text().toDouble( &conversionSuccess );
409-
if ( !conversionSuccess ) {return;}
411+
if ( !conversionSuccess )
412+
return;
410413
ymax = mYMaxLineEdit->text().toDouble( &conversionSuccess );
411-
if ( !conversionSuccess ) {return;}
414+
if ( !conversionSuccess )
415+
return;
412416

413417
QgsRectangle newExtent( xmin, ymin, xmax, ymax );
414418
mComposerMap->beginCommand( tr( "Map extent changed" ) );

src/app/legend/qgslegend.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,8 @@ void QgsLegend::legendLayerShowInOverview()
870870
return;
871871

872872
QgsLegendLayer* ll = qobject_cast<QgsLegendLayer *>( li );
873-
if ( !ll ) return;
873+
if ( !ll )
874+
return;
874875
ll->showInOverview();
875876
}
876877

@@ -1805,7 +1806,7 @@ void QgsLegend::legendLayerZoom()
18051806
}
18061807
}
18071808

1808-
if( extent.isEmpty() )
1809+
if ( extent.isEmpty() )
18091810
{
18101811
return;
18111812
}

src/app/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ int main( int argc, char *argv[] )
448448
}
449449

450450
// GUI customization is enabled by default unless --nocustomization argument is used
451-
QgsCustomization::instance()->setEnabled(myCustomization);
451+
QgsCustomization::instance()->setEnabled( myCustomization );
452452

453453
QgsApplication myApp( argc, argv, myUseGuiFlag, configpath );
454454

@@ -624,10 +624,10 @@ int main( int argc, char *argv[] )
624624
QgisApp *qgis = new QgisApp( mypSplash, myRestorePlugins ); // "QgisApp" used to find canonical instance
625625
qgis->setObjectName( "QgisApp" );
626626

627-
myApp.connect (
628-
&myApp, SIGNAL( preNotify( QObject *, QEvent *, bool *)),
627+
myApp.connect(
628+
&myApp, SIGNAL( preNotify( QObject *, QEvent *, bool * ) ),
629629
//qgis, SLOT( preNotify( QObject *, QEvent *))
630-
QgsCustomization::instance(), SLOT( preNotify( QObject *, QEvent *, bool *))
630+
QgsCustomization::instance(), SLOT( preNotify( QObject *, QEvent *, bool * ) )
631631
);
632632

633633
/////////////////////////////////////////////////////////////////////

src/app/qgisapp.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -983,9 +983,9 @@ void QgisApp::createMenus()
983983

984984
// Panel and Toolbar Submenus
985985
mPanelMenu = new QMenu( tr( "Panels" ) );
986-
mPanelMenu->setObjectName("mPanelMenu");
986+
mPanelMenu->setObjectName( "mPanelMenu" );
987987
mToolbarMenu = new QMenu( tr( "Toolbars" ) );
988-
mToolbarMenu->setObjectName("mToolbarMenu");
988+
mToolbarMenu->setObjectName( "mToolbarMenu" );
989989

990990
// Get platform for menu layout customization (Gnome, Kde, Mac, Win)
991991
QDialogButtonBox::ButtonLayout layout =
@@ -1079,9 +1079,9 @@ void QgisApp::createToolBars()
10791079

10801080
QList<QAction*> toolbarMenuActions;
10811081
// Set action names so that they can be used in customization
1082-
foreach ( QToolBar *toolBar, toolbarMenuToolBars )
1082+
foreach( QToolBar *toolBar, toolbarMenuToolBars )
10831083
{
1084-
toolBar->toggleViewAction()->setObjectName ( "mActionToggle" + toolBar->objectName().mid(1) );
1084+
toolBar->toggleViewAction()->setObjectName( "mActionToggle" + toolBar->objectName().mid( 1 ) );
10851085
toolbarMenuActions << toolBar->toggleViewAction();
10861086
}
10871087

@@ -2448,16 +2448,16 @@ void QgisApp::addWmsLayer()
24482448
QgsDebugMsg( "about to addRasterLayer" );
24492449

24502450
// TODO: QDialog for now, switch to QWidget in future
2451-
QDialog *wmss = dynamic_cast<QDialog*> ( QgsProviderRegistry::instance()->getSelectWidget( QString("wms"), this ) );
2452-
if ( !wmss )
2451+
QDialog *wmss = dynamic_cast<QDialog*>( QgsProviderRegistry::instance()->selectWidget( QString( "wms" ), this ) );
2452+
if ( !wmss )
24532453
{
24542454
QMessageBox::warning( this, tr( "WMS" ), tr( "Cannot get WMS select dialog from provider." ) );
2455-
return;
2455+
return;
24562456
}
2457-
connect ( wmss , SIGNAL ( addRasterLayer( QString const &, QString const &, QString const &,QStringList const &,QStringList const &,QString const &,
2458-
QString const &) ),
2459-
this , SLOT ( addRasterLayer( QString const &, QString const &, QString const &,QStringList const &,QStringList const &,QString const &,
2460-
QString const &) ) );
2457+
connect( wmss , SIGNAL( addRasterLayer( QString const &, QString const &, QString const &, QStringList const &, QStringList const &, QString const &,
2458+
QString const & ) ),
2459+
this , SLOT( addRasterLayer( QString const &, QString const &, QString const &, QStringList const &, QStringList const &, QString const &,
2460+
QString const & ) ) );
24612461
wmss->exec();
24622462
delete wmss;
24632463
}
@@ -3103,8 +3103,10 @@ void QgisApp::toggleActiveWindowMaximized()
31033103
QWidget *window = QApplication::activeWindow();
31043104
if ( window )
31053105
{
3106-
if ( window->isMaximized() ) window->showNormal();
3107-
else window->showMaximized();
3106+
if ( window->isMaximized() )
3107+
window->showNormal();
3108+
else
3109+
window->showMaximized();
31083110
}
31093111
}
31103112

@@ -4554,8 +4556,8 @@ void QgisApp::showPluginManager()
45544556
// implementation of the python runner
45554557
class QgsPythonRunnerImpl : public QgsPythonRunner
45564558
{
4557-
public:
4558-
QgsPythonRunnerImpl(QgsPythonUtils* pythonUtils) : mPythonUtils(pythonUtils) {}
4559+
public:
4560+
QgsPythonRunnerImpl( QgsPythonUtils* pythonUtils ) : mPythonUtils( pythonUtils ) {}
45594561
virtual bool runCommand( QString command, QString messageOnError = QString() )
45604562
{
45614563
if ( mPythonUtils && mPythonUtils->isEnabled() )
@@ -4565,7 +4567,7 @@ class QgsPythonRunnerImpl : public QgsPythonRunner
45654567
return false;
45664568
}
45674569

4568-
protected:
4570+
protected:
45694571
QgsPythonUtils* mPythonUtils;
45704572
};
45714573

@@ -4615,7 +4617,7 @@ void QgisApp::loadPythonSupport()
46154617
QgsPluginRegistry::instance()->setPythonUtils( mPythonUtils );
46164618

46174619
// init python runner
4618-
QgsPythonRunner::setInstance( new QgsPythonRunnerImpl(mPythonUtils) );
4620+
QgsPythonRunner::setInstance( new QgsPythonRunnerImpl( mPythonUtils ) );
46194621

46204622
std::cout << "Python support ENABLED :-) " << std::endl; // OK
46214623
}
@@ -5477,7 +5479,8 @@ void QgisApp::updateMouseCoordinatePrecision()
54775479
dp = QgsProject::instance()->readNumEntry( "PositionPrecision", "/DecimalPlaces" );
54785480

54795481
// Keep dp sensible
5480-
if ( dp < 0 ) dp = 0;
5482+
if ( dp < 0 )
5483+
dp = 0;
54815484

54825485
mMousePrecisionDecimalPlaces = dp;
54835486
}

src/app/qgsabout.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ void QgsAbout::init()
7171
{
7272
line = stream.readLine(); // line of text excluding '\n'
7373
//ignore the line if it starts with a hash....
74-
if ( line.left( 1 ) == "#" ) continue;
74+
if ( line.left( 1 ) == "#" )
75+
continue;
7576
QStringList myTokens = line.split( "\t", QString::SkipEmptyParts );
7677
lines << myTokens[0];
7778
}
@@ -102,7 +103,8 @@ void QgsAbout::init()
102103
{
103104
line = stream.readLine(); // line of text excluding '\n'
104105
//ignore the line if it starts with a hash....
105-
if ( line.left( 1 ) == "#" ) continue;
106+
if ( line.left( 1 ) == "#" )
107+
continue;
106108
lines += line;
107109
}
108110
file2.close();
@@ -129,7 +131,8 @@ void QgsAbout::init()
129131
"money to fund QGIS development and other project costs see "
130132
"<a href=\"http://qgis.org/en/sponsorship/donors.html\">"
131133
"http://qgis.org/en/sponsorship/donors.html</a></p>" );
132-
/*QString website;
134+
#if 0
135+
QString website;
133136
QTextStream donorsStream( &donorsFile );
134137
// Always use UTF-8
135138
donorsStream.setCodec( "UTF-8" );
@@ -138,7 +141,8 @@ void QgsAbout::init()
138141
{
139142
sline = donorsStream.readLine(); // line of text excluding '\n'
140143
//ignore the line if it starts with a hash....
141-
if ( sline.left( 1 ) == "#" ) continue;
144+
if ( sline.left( 1 ) == "#" )
145+
continue;
142146
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
143147
if ( myTokens.size() > 1 )
144148
{
@@ -153,7 +157,8 @@ void QgsAbout::init()
153157
// close the row
154158
donorsHTML += "</tr>";
155159
}
156-
donorsHTML += "</table>";*/
160+
donorsHTML += "</table>";
161+
#endif
157162

158163
QString myStyle = QgsApplication::reportStyleSheet();
159164
txtDonors->clear();
@@ -187,7 +192,8 @@ void QgsAbout::init()
187192
{
188193
sline = translatorStream.readLine(); // line of text excluding '\n'
189194
//ignore the line if it starts with a hash....
190-
if ( sline.left( 1 ) == "#" ) continue;
195+
if ( sline.left( 1 ) == "#" )
196+
continue;
191197
QStringList myTokens = sline.split( "|", QString::SkipEmptyParts );
192198
if ( myTokens.size() > 1 )
193199
{

src/app/qgsattributeactiondialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ void QgsAttributeActionDialog::remove()
164164
attributeActionTable->removeRow( row );
165165

166166
// And select the row below the one that was selected or the last one.
167-
if ( row >= attributeActionTable->rowCount() ) row = attributeActionTable->rowCount() - 1;
167+
if ( row >= attributeActionTable->rowCount() )
168+
row = attributeActionTable->rowCount() - 1;
168169
attributeActionTable->selectRow( row );
169170
}
170171
}
171172

172173
void QgsAttributeActionDialog::insert()
173174
{
174175
// Add the action details as a new row in the table.
175-
176176
int pos = attributeActionTable->rowCount();
177177
insert( pos );
178178
}

src/app/qgsconfigureshortcutsdialog.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ void QgsConfigureShortcutsDialog::changeShortcut()
212212
void QgsConfigureShortcutsDialog::resetShortcut()
213213
{
214214
QAction* action = currentAction();
215-
if ( !action ) return;
215+
if ( !action )
216+
return;
216217

217218
// set default shortcut
218219
QString shortcut = QgsShortcutsManager::instance()->actionDefaultShortcut( action );
@@ -361,7 +362,8 @@ void QgsConfigureShortcutsDialog::setGettingShortcut( bool getting )
361362
void QgsConfigureShortcutsDialog::setCurrentActionShortcut( QKeySequence s )
362363
{
363364
QAction* action = currentAction();
364-
if ( !action ) return;
365+
if ( !action )
366+
return;
365367

366368
// first check whether this action is not taken already
367369
QAction* otherAction = QgsShortcutsManager::instance()->actionForShortcut( s );

0 commit comments

Comments
 (0)