File indexing completed on 2024-05-12 15:58:52
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISSEQUENTIALITERATORPROGRESS_H 0008 #define KISSEQUENTIALITERATORPROGRESS_H 0009 0010 #include "kis_sequential_iterator.h" 0011 #include <KoProgressProxy.h> 0012 #include <KoFakeProgressProxy.h> 0013 0014 struct ProxyBasedProgressPolicy 0015 { 0016 ProxyBasedProgressPolicy(KoProgressProxy *proxy) 0017 : m_proxy(proxy ? proxy : KoFakeProgressProxy::instance()) 0018 { 0019 } 0020 0021 void setRange(int minimum, int maximum) 0022 { 0023 m_proxy->setRange(minimum, maximum); 0024 } 0025 0026 void setValue(int value) 0027 { 0028 m_proxy->setValue(value); 0029 } 0030 0031 void setFinished() 0032 { 0033 m_proxy->setValue(m_proxy->maximum()); 0034 } 0035 0036 private: 0037 KoProgressProxy *m_proxy; 0038 }; 0039 0040 typedef KisSequentialIteratorBase<ReadOnlyIteratorPolicy<>, DevicePolicy, ProxyBasedProgressPolicy> KisSequentialConstIteratorProgress; 0041 typedef KisSequentialIteratorBase<WritableIteratorPolicy<>, DevicePolicy, ProxyBasedProgressPolicy> KisSequentialIteratorProgress; 0042 0043 0044 #endif // KISSEQUENTIALITERATORPROGRESS_H