Skip to content
Permalink
Browse files
automatic indentation update (r9447-r9610)
git-svn-id: http://svn.osgeo.org/qgis/trunk@9611 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 9, 2008
1 parent b40ceb2 commit 5fb69d1ad0149bda854d381e7ec9908756ce5733
@@ -1847,7 +1847,7 @@ void QgisApp::restoreSessionPlugins( QString thePluginDirString )
{
QString myFullPath = thePluginDirString + "/" + myPluginDir[i];

QString baseName = QFileInfo(myFullPath).baseName();
QString baseName = QFileInfo( myFullPath ).baseName();
QLibrary *myLib = new QLibrary( myFullPath );
bool loaded = myLib->load();
if ( loaded )
@@ -1859,7 +1859,7 @@ void QgisApp::restoreSessionPlugins( QString thePluginDirString )
if ( myName && myDescription && myVersion )
{
//check if the plugin was active on last session

// Windows stores a "true" value as a 1 in the registry so we
// have to use readBoolEntry in this function

@@ -4210,17 +4210,17 @@ void QgisApp::loadPythonPlugin( QString packageName, QString pluginName )


QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();

// is loaded already?
if ( ! pRegistry->isLoaded(packageName) )
if ( ! pRegistry->isLoaded( packageName ) )
{
mPythonUtils->loadPlugin( packageName );
mPythonUtils->startPlugin( packageName );

// TODO: test success

// add to plugin registry
pRegistry->addPlugin( packageName, QgsPluginMetadata( packageName, pluginName, NULL, true) );
pRegistry->addPlugin( packageName, QgsPluginMetadata( packageName, pluginName, NULL, true ) );

// add to settings
QSettings settings;
@@ -4236,10 +4236,10 @@ void QgisApp::loadPlugin( QString theFullPathName, QString name )
QSettings settings;
// first check to see if its already loaded
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
QString baseName = QFileInfo(theFullPathName).baseName();
if ( pRegistry->isLoaded(baseName) )

QString baseName = QFileInfo( theFullPathName ).baseName();

if ( pRegistry->isLoaded( baseName ) )
{
// plugin is loaded
// QMessageBox::warning(this, "Already Loaded", description + " is already loaded");
@@ -4272,7 +4272,7 @@ void QgisApp::loadPlugin( QString theFullPathName, QString name )
{
pl->initGui();
// add it to the plugin registry
pRegistry->addPlugin(baseName, QgsPluginMetadata(myLib->fileName(), name, pl) );
pRegistry->addPlugin( baseName, QgsPluginMetadata( myLib->fileName(), name, pl ) );
//add it to the qsettings file [ts]
settings.setValue( "/Plugins/" + baseName, true );
}
@@ -73,7 +73,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
QSettings settings;
double searchRadius = settings.value( "/qgis/digitizing/search_radius_vertex_edit", 10 ).toDouble();
QgsRectangle selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius,
layerCoords.x() + searchRadius, layerCoords.y() + searchRadius );
layerCoords.x() + searchRadius, layerCoords.y() + searchRadius );

vlayer->select( QgsAttributeList(), selectRect, true );

@@ -167,7 +167,7 @@ void QgsPluginManager::getPythonPluginDescriptions()

// check to see if the plugin is loaded and set the checkbox accordingly
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
if ( pRegistry->isLoaded(packageName) && pRegistry->isPythonPlugin(packageName) )
if ( pRegistry->isLoaded( packageName ) && pRegistry->isPythonPlugin( packageName ) )
{
QgsDebugMsg( "Found plugin in the registry" );
// set the checkbox
@@ -293,11 +293,11 @@ void QgsPluginManager::getPluginDescriptions()
delete myLib;
continue;
}

QString pluginName = pName();
QString pluginDesc = pDesc();
QString pluginVersion = pVersion();
QString baseName = QFileInfo(lib).baseName();
QString baseName = QFileInfo( lib ).baseName();

QString myLibraryName = pluginDir[i];
// filtering will be done on the display role so give it name and desription
@@ -318,15 +318,15 @@ void QgsPluginManager::getPluginDescriptions()
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();

// get the library using the plugin description
if ( !pRegistry->isLoaded(baseName) )
if ( !pRegistry->isLoaded( baseName ) )
{
QgsDebugMsg( "Couldn't find plugin in the registry" );
}
else
{
QgsDebugMsg( "Found plugin in the registry" );
// TODO: this check shouldn't be necessary, plugin base names must be unique
if ( pRegistry->library(baseName) == myLib->fileName() )
if ( pRegistry->library( baseName ) == myLib->fileName() )
{
// set the checkbox
myData.setChecked( true );
@@ -363,12 +363,12 @@ void QgsPluginManager::unload()
myIndex = mModelPlugins->index( row, 0 );
// its off -- see if it is loaded and if so, unload it
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();

// is loaded?
QString baseName = mModelPlugins->data( myIndex, PLUGIN_BASE_NAME_ROLE ).toString();
if ( ! pRegistry->isLoaded( baseName ) )
continue;

if ( pRegistry->isPythonPlugin( baseName ) )
{
if ( mPythonUtils && mPythonUtils->isEnabled() )
@@ -471,10 +471,10 @@ void QgsPluginManager::on_vwPlugins_clicked( const QModelIndex &theIndex )
// the index row in the underlying model so we need to jump through this
// little hoop to get the correct item
//
QModelIndex realIndex = mModelProxy->mapToSource(theIndex);
QStandardItem* mypItem = mModelPlugins->itemFromIndex(realIndex);
QgsDetailedItemData myData =

QModelIndex realIndex = mModelProxy->mapToSource( theIndex );
QStandardItem* mypItem = mModelPlugins->itemFromIndex( realIndex );
QgsDetailedItemData myData =
qVariantValue<QgsDetailedItemData>( mypItem->data( PLUGIN_DATA_ROLE ) );
if ( myData.isChecked() )
{
@@ -46,62 +46,62 @@ void QgsPluginRegistry::setPythonUtils( QgsPythonUtils* pythonUtils )

bool QgsPluginRegistry::isLoaded( QString key )
{
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find(key);
return (it != mPlugins.end());
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find( key );
return ( it != mPlugins.end() );
}

QString QgsPluginRegistry::library( QString key )
{
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find(key);
if (it == mPlugins.end())
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find( key );
if ( it == mPlugins.end() )
return QString();

return it->library();
}

QgisPlugin *QgsPluginRegistry::plugin( QString key )
{
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find(key);
if (it == mPlugins.end())
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find( key );
if ( it == mPlugins.end() )
return NULL;

return it->plugin();
}

bool QgsPluginRegistry::isPythonPlugin( QString key )
{
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find(key);
if (it == mPlugins.end())
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find( key );
if ( it == mPlugins.end() )
return false;
return it->isPython();
}

void QgsPluginRegistry::addPlugin( QString key, QgsPluginMetadata metadata )
{
mPlugins.insert(key, metadata);
mPlugins.insert( key, metadata );
}

void QgsPluginRegistry::dump()
{
QgsDebugMsg("PLUGINS IN REGISTRY: key -> (name, library, isPython)");
QgsDebugMsg( "PLUGINS IN REGISTRY: key -> (name, library, isPython)" );
for ( QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.begin();
it != mPlugins.end();
it++ )
{
QgsDebugMsg(QString("PLUGIN: %1 -> (%2, %3, %4)")
.arg(it.key())
.arg(it->name())
.arg(it->library())
.arg(it->isPython()));
QgsDebugMsg( QString( "PLUGIN: %1 -> (%2, %3, %4)" )
.arg( it.key() )
.arg( it->name() )
.arg( it->library() )
.arg( it->isPython() ) );
}
}


void QgsPluginRegistry::removePlugin( QString key )
{
QgsDebugMsg("removing plugin: "+key);
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find(key);
if (it != mPlugins.end())
QgsDebugMsg( "removing plugin: " + key );
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.find( key );
if ( it != mPlugins.end() )
{
mPlugins.erase( it );
}
@@ -113,10 +113,10 @@ void QgsPluginRegistry::unloadAll()
it != mPlugins.end();
it++ )
{
if (isPythonPlugin(it.key()))
if ( isPythonPlugin( it.key() ) )
{
if (mPythonUtils)
mPythonUtils->unloadPlugin(it->library());
if ( mPythonUtils )
mPythonUtils->unloadPlugin( it->library() );
else
QgsDebugMsg( "warning: python utils is NULL" );
}
@@ -125,7 +125,7 @@ void QgsPluginRegistry::unloadAll()
if ( it->plugin() )
it->plugin()->unload();
else
QgsDebugMsg("warning: plugin is NULL:" + it.key());
QgsDebugMsg( "warning: plugin is NULL:" + it.key() );
}
}
}
@@ -41,38 +41,38 @@ class QgsPluginRegistry
public:
//! Returns the instance pointer, creating the object on the first call
static QgsPluginRegistry* instance();

//! Check whether this module is loaded
bool isLoaded( QString key );

//! Retrieve library of the plugin
QString library( QString key );

//! Retrieve a pointer to a loaded plugin
QgisPlugin * plugin( QString key );

//! Return whether the plugin is pythonic
bool isPythonPlugin( QString key );

//! Add a plugin to the map of loaded plugins
void addPlugin( QString key, QgsPluginMetadata metadata );

//! Remove a plugin from the list of loaded plugins
void removePlugin( QString key );

//! Unload plugins
void unloadAll();

//! Save pointer for python utils (needed for unloading python plugins)
void setPythonUtils( QgsPythonUtils* pythonUtils );

//! Dump list of plugins
void dump();

protected:
//! protected constructor
QgsPluginRegistry();

private:
static QgsPluginRegistry* _instance;
QMap<QString, QgsPluginMetadata> mPlugins;
@@ -45,42 +45,42 @@ QString QgsPythonDialog::escapeHtml( QString text )

void QgsPythonDialog::keyPressEvent( QKeyEvent *ev )
{
switch( ev->key() )
switch ( ev->key() )
{
case Qt::Key_Up:
case Qt::Key_Up:
{
if(pos>0)
if ( pos > 0 )
{
if( pos==history.size() )
if ( pos == history.size() )
history << edtCmdLine->text();
else
history[pos] = edtCmdLine->text();
pos--;
edtCmdLine->setText(history[pos]);
edtCmdLine->setText( history[pos] );
}
}
break;
case Qt::Key_Down:
case Qt::Key_Down:
{
if( pos<history.size()-1 )
if ( pos < history.size() - 1 )
{
history[pos] = edtCmdLine->text();
pos++;
edtCmdLine->setText(history[pos]);
edtCmdLine->setText( history[pos] );
}
}
break;
default:
QWidget::keyPressEvent(ev);
break;
default:
QWidget::keyPressEvent( ev );
break;
}
}

void QgsPythonDialog::on_edtCmdLine_returnPressed()
{
QString command = edtCmdLine->text();

if( !command.isEmpty() )
if ( !command.isEmpty() )
{
history << command;
pos = history.size();
@@ -276,8 +276,8 @@ class CORE_EXPORT QgsGeometry
/** Returns a geometry representing the points shared by this geometry and other. */
QgsGeometry* intersection( QgsGeometry* geometry );

/** Returns a geometry representing all the points in this geometry and other (a
* union geometry operation).
/** Returns a geometry representing all the points in this geometry and other (a
* union geometry operation).
* @note this operation is not called union since its a reserved word in C++.*/
QgsGeometry* combine( QgsGeometry* geometry );

Loading

0 comments on commit 5fb69d1

Please sign in to comment.