1 /*
2  * Copyright (c) 2012-2020 Meltytech, LLC
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "windowstools.h"
19 
WindowsTaskbarButton()20 WindowsTaskbarButton::WindowsTaskbarButton()
21 {
22 }
23 
getInstance()24 WindowsTaskbarButton& WindowsTaskbarButton::getInstance()
25 {
26     static WindowsTaskbarButton* instance = 0;
27     if (!instance)
28         instance = new WindowsTaskbarButton();
29     return *instance;
30 }
31 
setParentWindow(QWidget * parent)32 void WindowsTaskbarButton::setParentWindow(QWidget* parent)
33 {
34     m_taskbarButton = new QWinTaskbarButton(parent);
35     m_taskbarButton->setWindow(parent->windowHandle());
36     m_taskbarProgress = m_taskbarButton->progress();
37 }
38 
setProgress(int progress)39 void WindowsTaskbarButton::setProgress(int progress)
40 {
41     if (m_taskbarProgress != NULL)
42     {
43         m_taskbarProgress->setVisible(true);
44         m_taskbarProgress->setValue(progress);
45     }
46 }
47 
resetProgress()48 void WindowsTaskbarButton::resetProgress()
49 {
50     if (m_taskbarProgress != NULL)
51     {
52         m_taskbarProgress->setVisible(false);
53         m_taskbarProgress->reset();
54     }
55 }
56