Skip to content
Permalink
Browse files

Emit signals from QgsHttpTransaction that allow progress bar and canc…

…eling of current transation

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9938 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jan 7, 2009
1 parent af7dc44 commit 2305c473c490845687e4ccd61561b54b87357ee8
Showing with 23 additions and 3 deletions.
  1. +13 −1 src/core/qgshttptransaction.cpp
  2. +10 −2 src/core/qgshttptransaction.h
@@ -184,7 +184,8 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red
// QgsDebugMsg("Response received; being '" + httpresponsestring + "'.");
#endif

delete http;
delete http;
http = 0;

// Did we get an error? If so, bail early
if ( !mError.isNull() )
@@ -287,6 +288,9 @@ void QgsHttpTransaction::dataProgress( int done, int total )
// We saw something come back, therefore restart the watchdog timer
mWatchdogTimer->start( NETWORK_TIMEOUT_MSEC );

emit dataReadProgress(done);
emit totalSteps(total);

QString status;

if ( total )
@@ -464,4 +468,12 @@ QString QgsHttpTransaction::errorString()
return mError;
}

void QgsHttpTransaction::abort()
{
if(http)
{
http->abort();
}
}

// ENDS
@@ -99,10 +99,18 @@ class CORE_EXPORT QgsHttpTransaction : public QObject

void networkTimedOut();

/**Aborts the current transaction*/
void abort();

signals:

/** \brief emit a signal to notify of a progress event */
void setProgress( int theProgress, int theTotalSteps );
/**legacy code. This signal is currently not emitted and only kept for API compatibility*/
void setProgress(int done, int total);

/**Signal for progress update */
void dataReadProgress( int theProgress);
/**Signal for adjusted number of steps*/
void totalSteps(int theTotalSteps);

/** \brief emit a signal to be caught by qgisapp and display a msg on status bar */
void statusChanged( QString theStatusQString );

0 comments on commit 2305c47

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