File indexing completed on 2024-05-12 15:58:12

0001 /*
0002  *  SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_composite_progress_proxy.h"
0008 
0009 #include "kis_debug.h"
0010 
0011 void KisCompositeProgressProxy::addProxy(KoProgressProxy *proxy)
0012 {
0013     m_proxies.append(proxy);
0014     if (!m_uniqueProxies.contains(proxy)) {
0015         m_uniqueProxies.append(proxy);
0016     }
0017 }
0018 
0019 void KisCompositeProgressProxy::removeProxy(KoProgressProxy *proxy)
0020 {
0021     m_proxies.removeOne(proxy);
0022     if (!m_proxies.contains(proxy)) {
0023         m_uniqueProxies.removeOne(proxy);
0024     }
0025 }
0026 
0027 int KisCompositeProgressProxy::maximum() const
0028 {
0029     if(m_proxies.isEmpty()) return 0;
0030 
0031     return m_proxies.first()->maximum();
0032 }
0033 
0034 void KisCompositeProgressProxy::setValue(int value)
0035 {
0036     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
0037         proxy->setValue(value);
0038     }
0039 }
0040 
0041 void KisCompositeProgressProxy::setRange(int minimum, int maximum)
0042 {
0043     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
0044         proxy->setRange(minimum, maximum);
0045     }
0046 }
0047 
0048 void KisCompositeProgressProxy::setFormat(const QString &format)
0049 {
0050     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
0051         proxy->setFormat(format);
0052     }
0053 }
0054 
0055 void KisCompositeProgressProxy::setAutoNestedName(const QString &name)
0056 {
0057     Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
0058         proxy->setAutoNestedName(name);
0059     }
0060 }
0061