Skip to content
Permalink
Browse files

[GRASS] change canceled import item icon / label

  • Loading branch information
blazek committed Jun 25, 2015
1 parent 7ce4edf commit 580ae038704826a2f63c87e92ff5bdb7038fdfaa
@@ -165,6 +165,7 @@ int main( int argc, char **argv )
if ( isPolygon )
{
tmpMap = QgsGrass::vectNewMapStruct();
// TODO: use Vect_open_tmp_new with GRASS 7
Vect_open_new( tmpMap, tmpName.toUtf8().data(), 0 );
map = tmpMap;
}
@@ -21,6 +21,13 @@

#include <setjmp.h>

// for Sleep / usleep for debugging
#ifdef Q_OS_WIN
#include <windows.h>
#else
#include <time.h>
#endif

#include "qgsgrass.h"

#include "qgslogger.h"
@@ -2258,3 +2265,14 @@ void GRASS_LIB_EXPORT QgsGrass::vectDestroyMapStruct( struct Map_info *map )
qgsFree( map );
map = 0;
}

void GRASS_LIB_EXPORT QgsGrass::sleep( int ms )
{
// Stolen from QTest::qSleep
#ifdef Q_OS_WIN
Sleep( uint( ms ) );
#else
struct timespec ts = { ms / 1000, ( ms % 1000 ) * 1000 * 1000 };
nanosleep( &ts, NULL );
#endif
}
@@ -421,6 +421,9 @@ class QgsGrass
// Free struct Map_info
static GRASS_LIB_EXPORT void vectDestroyMapStruct( struct Map_info *map );

// Sleep miliseconds (for debugging)
static GRASS_LIB_EXPORT void sleep( int ms );

private:
static int initialized; // Set to 1 after initialization
static bool active; // is active mode
@@ -833,7 +833,7 @@ QgsGrassImportItem::QgsGrassImportItem( QgsDataItem* parent, const QString& name
, mImport( import )
{
setCapabilities( QgsDataItem::NoCapabilities ); // disable fertility
setState( Populating );
setState( Populated );

QgsGrassImportIcon::instance()->connectFrameChanged( this, SLOT( emitDataChanged() ) );
}
@@ -862,12 +862,27 @@ void QgsGrassImportItem::cancel()
QgsDebugMsg( "mImport is null" );
return;
}
if ( mImport->isCanceled() )
{
return;
}
mImport->cancel();
QgsGrassImportIcon::instance()->disconnectFrameChanged( this, SLOT( emitDataChanged() ) );
setName( name() + " : " + tr( "cancelling" ) );
emitDataChanged();
}

QIcon QgsGrassImportItem::icon()
{
return QgsGrassImportIcon::instance()->icon();
if ( mImport && mImport->isCanceled() )
{
setIconName( "/mIconDelete.png" );
return QgsDataItem::icon();
}
else
{
return QgsGrassImportIcon::instance()->icon();
}
}

//-------------------------------------------------------------------------

0 comments on commit 580ae03

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