Skip to content
Permalink
Browse files
Rename overloaded signal, flip remaining connects to new style
  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent f71c78e commit 252f2e1102a15d1f416fc0285ccecb5c0ed0269a
Showing with 18 additions and 13 deletions.
  1. +5 −0 python/core/qgstaskmanager.sip
  2. +1 −1 src/core/qgstaskmanager.cpp
  3. +1 −1 src/core/qgstaskmanager.h
  4. +9 −9 src/gui/qgstaskmanagerwidget.cpp
  5. +2 −2 tests/src/core/testqgstaskmanager.cpp
@@ -347,6 +347,11 @@ class QgsTaskManager : QObject
//! @param progress percent of progress, from 0.0 - 100.0
void progressChanged( long taskId, double progress );

//! Will be emitted when only a single task remains to complete
//! and that task has reported a progress change
//! @param progress percent of progress, from 0.0 - 100.0
void finalTaskProgressChanged( double progress );

//! Will be emitted when a task reports a status change
//! @param taskId ID of task
//! @param status new task status
@@ -352,7 +352,7 @@ void QgsTaskManager::taskProgressChanged( double progress )
emit progressChanged( id, progress );
if ( mActiveTasks.count() == 1 )
{
emit progressChanged( progress );
emit finalTaskProgressChanged( progress );
}
}

@@ -379,7 +379,7 @@ class CORE_EXPORT QgsTaskManager : public QObject
//! Will be emitted when only a single task remains to complete
//! and that task has reported a progress change
//! @param progress percent of progress, from 0.0 - 100.0
void progressChanged( double progress );
void finalTaskProgressChanged( double progress );

//! Will be emitted when a task reports a status change
//! @param taskId ID of task
@@ -75,10 +75,10 @@ QgsTaskManagerModel::QgsTaskManagerModel( QgsTaskManager *manager, QObject *pare
mRowToTaskIdMap.insert( i, mManager->taskId( task ) );
}

connect( mManager, SIGNAL( taskAdded( long ) ), this, SLOT( taskAdded( long ) ) );
connect( mManager, SIGNAL( taskAboutToBeDeleted( long ) ), this, SLOT( taskDeleted( long ) ) );
connect( mManager, SIGNAL( progressChanged( long, double ) ), this, SLOT( progressChanged( long, double ) ) );
connect( mManager, SIGNAL( statusChanged( long, int ) ), this, SLOT( statusChanged( long, int ) ) );
connect( mManager, &QgsTaskManager::taskAdded, this, &QgsTaskManagerModel::taskAdded );
connect( mManager, &QgsTaskManager::taskAboutToBeDeleted, this, &QgsTaskManagerModel::taskDeleted );
connect( mManager, &QgsTaskManager::progressChanged, this, &QgsTaskManagerModel::progressChanged );
connect( mManager, &QgsTaskManager::statusChanged, this, &QgsTaskManagerModel::statusChanged );
}

QModelIndex QgsTaskManagerModel::index( int row, int column, const QModelIndex &parent ) const
@@ -412,13 +412,13 @@ QgsTaskManagerStatusBarWidget::QgsTaskManagerStatusBarWidget( QgsTaskManager *ma
mFloatingWidget->setAnchorPoint( QgsFloatingWidget::BottomMiddle );
mFloatingWidget->setAnchorWidgetPoint( QgsFloatingWidget::TopMiddle );
mFloatingWidget->hide();
connect( this, SIGNAL( clicked( bool ) ), this, SLOT( toggleDisplay() ) );
connect( this, &QgsTaskManagerStatusBarWidget::clicked, this, &QgsTaskManagerStatusBarWidget::toggleDisplay );
hide();

connect( manager, SIGNAL( taskAdded( long ) ), this, SLOT( showButton() ) );
connect( manager, SIGNAL( allTasksFinished() ), this, SLOT( allFinished() ) );
connect( manager, SIGNAL( progressChanged( double ) ), this, SLOT( overallProgressChanged( double ) ) );
connect( manager, SIGNAL( countActiveTasksChanged( int ) ), this, SLOT( countActiveTasksChanged( int ) ) );
connect( manager, &QgsTaskManager::taskAdded, this, &QgsTaskManagerStatusBarWidget::showButton );
connect( manager, &QgsTaskManager::allTasksFinished, this, &QgsTaskManagerStatusBarWidget::allFinished );
connect( manager, &QgsTaskManager::finalTaskProgressChanged, this, &QgsTaskManagerStatusBarWidget::overallProgressChanged );
connect( manager, &QgsTaskManager::countActiveTasksChanged, this, &QgsTaskManagerStatusBarWidget::countActiveTasksChanged );
}

QSize QgsTaskManagerStatusBarWidget::sizeHint() const
@@ -361,8 +361,8 @@ void TestQgsTaskManager::progressChanged()
manager.addTask( task );
manager.addTask( task2 );

QSignalSpy spy( &manager, SIGNAL( progressChanged( long, double ) ) );
QSignalSpy spy2( &manager, SIGNAL( progressChanged( double ) ) );
QSignalSpy spy( &manager, &QgsTaskManager::progressChanged );
QSignalSpy spy2( &manager, &QgsTaskManager::finalTaskProgressChanged );

task->emitProgressChanged( 50.0 );
QCOMPARE( task->progress(), 50.0 );

0 comments on commit 252f2e1

Please sign in to comment.