Commit 275146af authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

Implement ProgressManager's progress-bar-on-icon on Windows 7.

Allow compiling with older Windows SDKs, link ole32 explictly.
If you want this feature to work, you need to compile and test
it on Windows 7.

Task-Number: QTCREATORBUG-252
parent 3565fe4e
......@@ -168,6 +168,7 @@ RESOURCES += core.qrc \
win32 {
SOURCES += progressmanager/progressmanager_win.cpp
LIBS += -lole32
}
else:macx {
OBJECTIVE_SOURCES += progressmanager/progressmanager_mac.mm
......
......@@ -50,10 +50,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent)
ProgressManagerPrivate::~ProgressManagerPrivate()
{
}
void ProgressManagerPrivate::init()
{
cleanup();
}
void ProgressManagerPrivate::cancelTasks(const QString &type)
......
......@@ -29,6 +29,14 @@
#include "progressmanager_p.h"
void Core::Internal::ProgressManagerPrivate::init()
{
}
void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#import <AppKit/NSDockTile.h>
#import <AppKit/NSApplication.h>
......
......@@ -48,6 +48,7 @@ public:
ProgressManagerPrivate(QObject *parent = 0);
~ProgressManagerPrivate();
void init();
void cleanup();
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
ProgressFlags flags);
......
......@@ -27,8 +27,91 @@
**
**************************************************************************/
#include <QtCore/QVariant>
#include <QtGui/QMainWindow>
#include <coreplugin/icore.h>
#include "progressmanager_p.h"
// for windows progress bar
#include <shobjidl.h>
// Windows 7 SDK required
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
namespace {
int total = 0;
ITaskbarList3* pITask = 0;
}
void Core::Internal::ProgressManagerPrivate::init()
{
CoInitialize(NULL);
HRESULT hRes = CoCreateInstance(CLSID_TaskbarList,
NULL,CLSCTX_INPROC_SERVER,
IID_ITaskbarList3,(LPVOID*) &pITask);
if (FAILED(hRes))
{
pITask = 0;
CoUninitialize();
return;
}
pITask->HrInit();
return;
}
void Core::Internal::ProgressManagerPrivate::cleanup()
{
if (pITask) {
pITask->Release();
pITask = NULL;
CoUninitialize();
}
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
{
Q_UNUSED(text)
}
void Core::Internal::ProgressManagerPrivate::setApplicationProgressRange(int min, int max)
{
total = max-min;
}
void Core::Internal::ProgressManagerPrivate::setApplicationProgressValue(int value)
{
if (pITask) {
WId winId = Core::ICore::instance()->mainWindow()->winId();
pITask->SetProgressValue(winId, value, total);
}
}
void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool visible)
{
if (!pITask)
return;
WId winId = Core::ICore::instance()->mainWindow()->winId();
if (visible)
pITask->SetProgressState(winId, TBPF_NORMAL);
else
pITask->SetProgressState(winId, TBPF_NOPROGRESS);
}
#else
void Core::Internal::ProgressManagerPrivate::init()
{
}
void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
{
Q_UNUSED(text)
......@@ -49,3 +132,6 @@ void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool
{
Q_UNUSED(visible)
}
#endif // __ITaskbarList2_INTERFACE_DEFINED__
......@@ -29,6 +29,14 @@
#include "progressmanager_p.h"
void Core::Internal::ProgressManagerPrivate::init()
{
}
void Core::Internal::ProgressManagerPrivate::cleanup()
{
}
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
{
Q_UNUSED(text)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment