Skip to content
Permalink
Browse files

Merge pull request #4126 from nyalldawson/task_progress

[win] Show task manager progress in windows task bar
  • Loading branch information
nyalldawson committed Feb 19, 2017
2 parents 9ed189e + 97f6a52 commit 32504b1a0b9dc6c4afe5fdc792591b6047cc4f01
Showing with 23 additions and 1 deletion.
  1. +3 −1 src/app/CMakeLists.txt
  2. +20 −0 src/app/qgisapp.cpp
4 src/app/CMakeLists.txt 100644 → 100755
@@ -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)
@@ -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)
20 src/app/qgisapp.cpp 100644 → 100755
@@ -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'
@@ -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 );

0 comments on commit 32504b1

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