Skip to content

Commit

Permalink
cleanups:
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jef-n committed May 23, 2011
1 parent ee6c516 commit 4549d0e
Show file tree
Hide file tree
Showing 116 changed files with 4,071 additions and 3,488 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsproviderregistry.sip
Expand Up @@ -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 */
Expand Down
18 changes: 9 additions & 9 deletions scripts/astyle-all.sh
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/analysis/interpolation/DualEdgeTriangulation.cc
Expand Up @@ -1979,7 +1979,6 @@ void DualEdgeTriangulation::ruppertRefinement()

}
while ( actedge != pointingedge );

}
}
}
Expand Down Expand Up @@ -2190,9 +2189,6 @@ void DualEdgeTriangulation::ruppertRefinement()

}
while ( actedge != pointingedge );



}
} //end fast method

Expand Down Expand Up @@ -2407,7 +2403,6 @@ void DualEdgeTriangulation::ruppertRefinement()

}
while ( actedge != pointingedge );

}
}

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/ParametricLine.h
Expand Up @@ -22,7 +22,7 @@
#include <QVector>

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*/
Expand Down
2 changes: 1 addition & 1 deletion src/app/attributetable/qgsattributetabledialog.cpp
Expand Up @@ -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 );
Expand Down
9 changes: 6 additions & 3 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -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 == "" )
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 == "" )
Expand Down
12 changes: 8 additions & 4 deletions src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -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" ) );
Expand Down
5 changes: 3 additions & 2 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -870,7 +870,8 @@ void QgsLegend::legendLayerShowInOverview()
return;

QgsLegendLayer* ll = qobject_cast<QgsLegendLayer *>( li );
if ( !ll ) return;
if ( !ll )
return;
ll->showInOverview();
}

Expand Down Expand Up @@ -1805,7 +1806,7 @@ void QgsLegend::legendLayerZoom()
}
}

if( extent.isEmpty() )
if ( extent.isEmpty() )
{
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/main.cpp
Expand Up @@ -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 );

Expand Down Expand Up @@ -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 * ) )
);

/////////////////////////////////////////////////////////////////////
Expand Down
39 changes: 21 additions & 18 deletions src/app/qgisapp.cpp
Expand Up @@ -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 =
Expand Down Expand Up @@ -1079,9 +1079,9 @@ void QgisApp::createToolBars()

QList<QAction*> 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();
}

Expand Down Expand Up @@ -2448,16 +2448,16 @@ void QgisApp::addWmsLayer()
QgsDebugMsg( "about to addRasterLayer" );

// TODO: QDialog for now, switch to QWidget in future
QDialog *wmss = dynamic_cast<QDialog*> ( QgsProviderRegistry::instance()->getSelectWidget( QString("wms"), this ) );
if ( !wmss )
QDialog *wmss = dynamic_cast<QDialog*>( 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;
}
Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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() )
Expand All @@ -4565,7 +4567,7 @@ class QgsPythonRunnerImpl : public QgsPythonRunner
return false;
}

protected:
protected:
QgsPythonUtils* mPythonUtils;
};

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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;
}
Expand Down
18 changes: 12 additions & 6 deletions src/app/qgsabout.cpp
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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();
Expand All @@ -129,7 +131,8 @@ void QgsAbout::init()
"money to fund QGIS development and other project costs see "
"<a href=\"http://qgis.org/en/sponsorship/donors.html\">"
"http://qgis.org/en/sponsorship/donors.html</a></p>" );
/*QString website;
#if 0
QString website;
QTextStream donorsStream( &donorsFile );
// Always use UTF-8
donorsStream.setCodec( "UTF-8" );
Expand All @@ -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 )
{
Expand All @@ -153,7 +157,8 @@ void QgsAbout::init()
// close the row
donorsHTML += "</tr>";
}
donorsHTML += "</table>";*/
donorsHTML += "</table>";
#endif

QString myStyle = QgsApplication::reportStyleSheet();
txtDonors->clear();
Expand Down Expand Up @@ -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 )
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributeactiondialog.cpp
Expand Up @@ -164,15 +164,15 @@ 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 );
}
}

void QgsAttributeActionDialog::insert()
{
// Add the action details as a new row in the table.

int pos = attributeActionTable->rowCount();
insert( pos );
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/qgsconfigureshortcutsdialog.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 4549d0e

Please sign in to comment.