Skip to content

Commit

Permalink
Emit signals from QgsHttpTransaction that allow progress bar and canc…
Browse files Browse the repository at this point in the history
…eling of current transation

git-svn-id: http://svn.osgeo.org/qgis/trunk@9938 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 7, 2009
1 parent 87a8e8d commit 64e9d93
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
14 changes: 13 additions & 1 deletion src/core/qgshttptransaction.cpp
Expand Up @@ -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() )
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -464,4 +468,12 @@ QString QgsHttpTransaction::errorString()
return mError;
}

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

// ENDS
12 changes: 10 additions & 2 deletions src/core/qgshttptransaction.h
Expand Up @@ -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 );
Expand Down

0 comments on commit 64e9d93

Please sign in to comment.