1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
33 #include <QtCore/QVariant>
34 #include <QtGui/QMainWindow>
35 #include <QtGui/QFont>
36 #include <QtGui/QFontMetrics>
37 #include <QtGui/QPixmap>
38 #include <QtGui/QPainter>
39 #include <QtGui/QLabel>
41 #include <coreplugin/icore.h>
43 #include "progressmanager_p.h"
45 // for windows progress bar
47 # include <shobjidl.h>
50 // Windows 7 SDK required
51 #ifdef __ITaskbarList3_INTERFACE_DEFINED__
55 ITaskbarList3* pITask = 0;
58 void Core::Internal::ProgressManagerPrivate::init()
61 HRESULT hRes = CoCreateInstance(CLSID_TaskbarList,
62 NULL,CLSCTX_INPROC_SERVER,
63 IID_ITaskbarList3,(LPVOID*) &pITask);
75 void Core::Internal::ProgressManagerPrivate::cleanup()
85 void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
90 WId winId = Core::ICore::instance()->mainWindow()->winId();
92 pITask->SetOverlayIcon(winId, NULL, NULL);
94 QPixmap pix = QPixmap(":/projectexplorer/images/compile_error.png");
97 QFont font = p.font();
98 font.setPointSize(font.pointSize()-2);
100 p.drawText(QRect(QPoint(0,0), pix.size()), Qt::AlignHCenter|Qt::AlignCenter, text);
101 pITask->SetOverlayIcon(winId, pix.toWinHICON(), (wchar_t*)text.utf16());
105 void Core::Internal::ProgressManagerPrivate::setApplicationProgressRange(int min, int max)
110 void Core::Internal::ProgressManagerPrivate::setApplicationProgressValue(int value)
113 WId winId = Core::ICore::instance()->mainWindow()->winId();
114 pITask->SetProgressValue(winId, value, total);
118 void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool visible)
123 WId winId = Core::ICore::instance()->mainWindow()->winId();
125 pITask->SetProgressState(winId, TBPF_NORMAL);
127 pITask->SetProgressState(winId, TBPF_NOPROGRESS);
132 void Core::Internal::ProgressManagerPrivate::init()
136 void Core::Internal::ProgressManagerPrivate::cleanup()
140 void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
145 void Core::Internal::ProgressManagerPrivate::setApplicationProgressRange(int min, int max)
151 void Core::Internal::ProgressManagerPrivate::setApplicationProgressValue(int value)
156 void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool visible)
162 #endif // __ITaskbarList2_INTERFACE_DEFINED__