1 /*
2  *  Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
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 2 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, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include "kis_composite_progress_proxy.h"
20 
21 #include "kis_debug.h"
22 
addProxy(KoProgressProxy * proxy)23 void KisCompositeProgressProxy::addProxy(KoProgressProxy *proxy)
24 {
25     m_proxies.append(proxy);
26     if (!m_uniqueProxies.contains(proxy)) {
27         m_uniqueProxies.append(proxy);
28     }
29 }
30 
removeProxy(KoProgressProxy * proxy)31 void KisCompositeProgressProxy::removeProxy(KoProgressProxy *proxy)
32 {
33     m_proxies.removeOne(proxy);
34     if (!m_proxies.contains(proxy)) {
35         m_uniqueProxies.removeOne(proxy);
36     }
37 }
38 
maximum() const39 int KisCompositeProgressProxy::maximum() const
40 {
41     if(m_proxies.isEmpty()) return 0;
42 
43     return m_proxies.first()->maximum();
44 }
45 
setValue(int value)46 void KisCompositeProgressProxy::setValue(int value)
47 {
48     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
49         proxy->setValue(value);
50     }
51 }
52 
setRange(int minimum,int maximum)53 void KisCompositeProgressProxy::setRange(int minimum, int maximum)
54 {
55     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
56         proxy->setRange(minimum, maximum);
57     }
58 }
59 
setFormat(const QString & format)60 void KisCompositeProgressProxy::setFormat(const QString &format)
61 {
62     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
63         proxy->setFormat(format);
64     }
65 }
66 
setAutoNestedName(const QString & name)67 void KisCompositeProgressProxy::setAutoNestedName(const QString &name)
68 {
69     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
70         proxy->setAutoNestedName(name);
71     }
72 }
73 
74