Skip to content
Permalink
Browse files

Use proxy task for oracle browser table scanning

  • Loading branch information
nyalldawson committed Aug 20, 2018
1 parent 485803d commit 48bf6278bc3bda8f2d9ff1365db7c481e5ed0630
Showing with 13 additions and 2 deletions.
  1. +11 −2 src/providers/oracle/qgsoracledataitems.cpp
  2. +2 −0 src/providers/oracle/qgsoracledataitems.h
@@ -22,6 +22,7 @@
#include "qgsapplication.h"
#include "qgsmessageoutput.h"
#include "qgsvectorlayer.h"
#include "qgsproxyprogresstask.h"

#include <QMessageBox>
#include <QProgressDialog>
@@ -93,6 +94,8 @@ QVector<QgsDataItem *> QgsOracleConnectionItem::createChildren()
QgsOracleConn::restrictToSchema( mName ),
/* useEstimatedMetadata */ true,
QgsOracleConn::allowGeometrylessTables( mName ) );
mColumnTypeTask = new QgsProxyProgressTask( tr( "Scanning tables for %1" ).arg( mName ) );
QgsApplication::taskManager()->addTask( mColumnTypeTask );

connect( mColumnTypeThread, &QgsOracleColumnTypeThread::setLayerType,
this, &QgsOracleConnectionItem::setLayerType );
@@ -101,8 +104,11 @@ QVector<QgsDataItem *> QgsOracleConnectionItem::createChildren()

if ( QgsOracleRootItem::sMainWindow )
{
connect( mColumnTypeThread, SIGNAL( progress( int, int ) ),
QgsOracleRootItem::sMainWindow, SLOT( showProgress( int, int ) ) );
connect( mColumnTypeThread, &QgsOracleColumnTypeThread::progress,
mColumnTypeTask, [ = ]( int i, int n )
{
mColumnTypeTask->setProxyProgress( 100.0 * static_cast< double >( i ) / n );
} );
connect( mColumnTypeThread, SIGNAL( progressMessage( QString ) ),
QgsOracleRootItem::sMainWindow, SLOT( showStatusMessage( QString ) ) );
}
@@ -127,6 +133,9 @@ void QgsOracleConnectionItem::threadStarted()

void QgsOracleConnectionItem::threadFinished()
{
mColumnTypeTask->finalize( true );
mColumnTypeTask = nullptr;

QgsDebugMsgLevel( QStringLiteral( "Entering." ), 3 );
setAllAsPopulated();
}
@@ -31,6 +31,7 @@ class QgsOracleRootItem;
class QgsOracleConnectionItem;
class QgsOracleOwnerItem;
class QgsOracleLayerItem;
class QgsProxyProgressTask;

class QgsOracleRootItem : public QgsDataCollectionItem
{
@@ -86,6 +87,7 @@ class QgsOracleConnectionItem : public QgsDataCollectionItem
void stop();
QMap<QString, QgsOracleOwnerItem * > mOwnerMap;
QgsOracleColumnTypeThread *mColumnTypeThread = nullptr;
QgsProxyProgressTask *mColumnTypeTask = nullptr;
void setAllAsPopulated();
};

0 comments on commit 48bf627

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