Skip to content
Permalink
Browse files

ows data items: population of children already runs in a thread - don…

…'t use subthreads for each provider (fixes #12507)
  • Loading branch information
jef-n committed Jun 8, 2015
1 parent ef62616 commit 402df0323e81b53c81d472b8376b6a0c8fb57eed
@@ -7051,6 +7051,9 @@ void QgisApp::showMouseCoordinate( const QgsPoint & p )
{
if ( mMapCanvas->mapUnits() == QGis::Degrees )
{
if ( !mMapCanvas->mapSettings().destinationCrs().isValid() )
return;

QgsPoint geo = p;
if ( !mMapCanvas->mapSettings().destinationCrs().geographicFlag() )
{
@@ -350,14 +350,14 @@ QVector<QgsDataItem*> QgsDataItem::createChildren()
return QVector<QgsDataItem*>();
}

void QgsDataItem::populate()
void QgsDataItem::populate( bool foreground )
{
if ( state() == Populated || state() == Populating )
return;

QgsDebugMsg( "mPath = " + mPath );

if ( capabilities2() & QgsDataItem::Fast )
if ( capabilities2() & QgsDataItem::Fast || foreground )
{
populate( createChildren() );
}
@@ -390,7 +390,7 @@ QVector<QgsDataItem*> QgsDataItem::runCreateChildren( QgsDataItem* item )
QgsDebugMsg( "moveToThread child " + child->path() );
child->moveToThread( QApplication::instance()->thread() ); // moves also children
}
QgsDebugMsg( "finished path = " + item->path() );
QgsDebugMsg( QString( "finished path %1: %2 children" ).arg( item->path() ).arg( children.size() ) );
return children;
}

@@ -241,7 +241,8 @@ class CORE_EXPORT QgsDataItem : public QObject
virtual void deleteLater();

// Populate children using children vector created by createChildren()
virtual void populate();
// @param foreground run createChildren in foreground
virtual void populate( bool foreground = false );

/** Remove children recursively and set as not populated. This is used when refreshing collapsed items. */
virtual void depopulate();
@@ -69,7 +69,7 @@ QVector<QgsDataItem*> QgsOWSConnectionItem::createChildren()
continue;
}

item->populate();
item->populate( true ); // populate in foreground - this is already run in a thread

layerCount += item->rowCount();
if ( item->rowCount() > 0 )
@@ -20,13 +20,9 @@
#include "qgswmscapabilities.h"
#include "qgswmsconnection.h"
#include "qgswmssourceselect.h"

#include "qgsnewhttpconnection.h"

#include "qgstilescalewidget.h"

#include "qgsapplication.h"

// ---------------------------------------------------------------------------
QgsWMSConnectionItem::QgsWMSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri )
: QgsDataCollectionItem( parent, name, path )
@@ -46,19 +42,7 @@ QVector<QgsDataItem*> QgsWMSConnectionItem::createChildren()

QgsDataSourceURI uri;
uri.setEncodedUri( mUri );
#if 0
if ( mPath.contains( "url=" ) )
{
encodedUri = mPath;
uri.setEncodedUri( encodedUri );
}
else
{
QgsWMSConnection connection( mName );
uri = connection.uri();
encodedUri = uri.encodedUri();
}
#endif

QgsDebugMsg( "mUri = " + mUri );

QgsWmsSettings wmsSettings;
@@ -70,25 +54,6 @@ QVector<QgsDataItem*> QgsWMSConnectionItem::createChildren()

QgsWmsCapabilitiesDownload capDownload( wmsSettings.baseUrl(), wmsSettings.authorization() );

#if 0
QWidget *mainWindow = 0;

QWidgetList topLevelWidgets = qApp->topLevelWidgets();
for ( QWidgetList::iterator it = topLevelWidgets.begin(); it != topLevelWidgets.end(); ++it )
{
if (( *it )->objectName() == "QgisApp" )
{
mainWindow = *it;
break;
}
}

if ( mainWindow )
{
connect( &capDownload, SIGNAL( statusChanged( QString ) ), mainWindow, SLOT( showStatusMessage( QString ) ) );
}
#endif

bool res = capDownload.downloadCapabilities();

if ( !res )
@@ -402,6 +367,7 @@ QWidget * QgsWMSRootItem::paramWidget()
connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) );
return select;
}

void QgsWMSRootItem::connectionsChanged()
{
refresh();

0 comments on commit 402df03

Please sign in to comment.
You can’t perform that action at this time.