Skip to content

Commit

Permalink
Merge pull request #4126 from nyalldawson/task_progress
Browse files Browse the repository at this point in the history
[win] Show task manager progress in windows task bar
  • Loading branch information
nyalldawson committed Feb 19, 2017
2 parents 9ed189e + 97f6a52 commit 32504b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ QT5_WRAP_CPP(QGIS_APP_MOC_SRCS ${QGIS_APP_MOC_HDRS})
SET (QGIS_APPMAIN_SRCS main.cpp)

IF (WIN32)
FIND_PACKAGE(Qt5WinExtras)

IF (MSVC)
SET (QGIS_APPMAIN_SRCS ${QGIS_APPMAIN_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/qgis_win32.rc)
ELSE(MSVC)
Expand Down Expand Up @@ -640,7 +642,7 @@ ENDIF (ANDROID)
IF(WIN32)
ADD_DEFINITIONS(-DQWT_DLL)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} DbgHelp)
TARGET_LINK_LIBRARIES(qgis_app DbgHelp)
TARGET_LINK_LIBRARIES(qgis_app DbgHelp Qt5::WinExtras )
ENDIF(WIN32)

IF (APPLE)
Expand Down
20 changes: 20 additions & 0 deletions src/app/qgisapp.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@
#include <qgsapplication.h>
#include <qgscomposition.h>
#include <qgslayerstylingwidget.h>
#include "qgstaskmanager.h"

#include <QNetworkReply>
#include <QNetworkProxy>
#include <QAuthenticator>

#ifdef Q_OS_WIN
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif

//
// Mac OS X Includes
// Must include before GEOS 3 due to unqualified use of 'Point'
Expand Down Expand Up @@ -1099,6 +1105,20 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
grabGesture( Qt::TapAndHoldGesture );
}


#ifdef Q_OS_WIN
QWinTaskbarButton* taskButton = new QWinTaskbarButton( this );
taskButton->setWindow( windowHandle() );

QWinTaskbarProgress* taskProgress = taskButton->progress();
taskProgress->setVisible( false );
connect( QgsApplication::taskManager(), &QgsTaskManager::taskAdded, taskProgress, [taskProgress] { taskProgress->setMaximum( 0 ); taskProgress->show(); }
);
connect( QgsApplication::taskManager(), &QgsTaskManager::finalTaskProgressChanged, taskProgress, [taskProgress]( double val ) { taskProgress->setMaximum( 100 );taskProgress->show(); taskProgress->setValue( val ); }
);
connect( QgsApplication::taskManager(), &QgsTaskManager::allTasksFinished, taskProgress, &QWinTaskbarProgress::hide );
#endif

// supposedly all actions have been added, now register them to the shortcut manager
QgsShortcutsManager::instance()->registerAllChildren( this );

Expand Down

0 comments on commit 32504b1

Please sign in to comment.