1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #include "WinSevenTaskbar.h"
27 #ifdef __ITaskbarList3_INTERFACE_DEFINED__
29 ITaskbarList3
*WinSevenTaskbar::m_ptbl
= NULL
;
31 WinSevenTaskbar::WinSevenTaskbar(void)
35 WinSevenTaskbar::~WinSevenTaskbar(void)
39 void WinSevenTaskbar::initTaskbar(void)
41 OSVERSIONINFOW version
;
42 memset(&version
, 0, sizeof(OSVERSIONINFOW
));
43 version
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOW
);
44 GetVersionEx(&version
);
46 if(version
.dwMajorVersion
>= 6 && version
.dwMinorVersion
>= 1)
51 HRESULT hr
= CoCreateInstance(CLSID_TaskbarList
, NULL
, CLSCTX_INPROC_SERVER
, IID_PPV_ARGS(&ptbl
));
55 HRESULT hr2
= ptbl
->HrInit();
63 qWarning("ITaskbarList3::HrInit() has failed.");
68 qWarning("ITaskbarList3 could not be created.");
74 qWarning("This OS doesn't support the ITaskbarList3 interface (needs NT 6.1 or later)");
78 void WinSevenTaskbar::setTaskbarState(QWidget
*window
, WinSevenTaskbarState state
)
84 case WinSevenTaskbarNoState
:
85 m_ptbl
->SetProgressState(window
->winId(), TBPF_NOPROGRESS
);
87 case WinSevenTaskbarNormalState
:
88 m_ptbl
->SetProgressState(window
->winId(), TBPF_NORMAL
);
90 case WinSevenTaskbarIndeterminateState
:
91 m_ptbl
->SetProgressState(window
->winId(), TBPF_INDETERMINATE
);
93 case WinSevenTaskbarErrorState
:
94 m_ptbl
->SetProgressState(window
->winId(), TBPF_ERROR
);
96 case WinSevenTaskbarPausedState
:
97 m_ptbl
->SetProgressState(window
->winId(), TBPF_PAUSED
);
103 void WinSevenTaskbar::setTaskbarProgress(QWidget
*window
, unsigned __int64 currentValue
, unsigned __int64 maximumValue
)
107 m_ptbl
->SetProgressValue(window
->winId(), currentValue
, maximumValue
);
111 void WinSevenTaskbar::setOverlayIcon(QWidget
*window
, QIcon
*icon
)
115 m_ptbl
->SetOverlayIcon(window
->winId(), (icon
? icon
->pixmap(16,16).toWinHICON() : NULL
), L
"LameXP");
119 #endif //__ITaskbarList3_INTERFACE_DEFINED__