File indexing completed on 2024-05-12 16:01:48
0001 /* 0002 * SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISIMAGEBARRIERLOCKERWITHFEEDBACK_H 0008 #define KISIMAGEBARRIERLOCKERWITHFEEDBACK_H 0009 0010 #include "kis_types.h" 0011 #include "kis_image_barrier_locker.h" 0012 #include "kritaui_export.h" 0013 0014 namespace KisImageBarrierLockerWithFeedbackImplPrivate { 0015 void KRITAUI_EXPORT blockWithFeedback(KisImageSP image); 0016 } 0017 0018 /** 0019 * The wrapper around KisImageBarrierLocker or KisImageBarrierLockerAllowNull 0020 * that adds GUI feedback with a progress bar when the locking is going to be 0021 * long enough. 0022 */ 0023 template<class InternalLocker> 0024 class KisImageBarrierLockerWithFeedbackImpl 0025 { 0026 public: 0027 KisImageBarrierLockerWithFeedbackImpl(KisImageSP image) { 0028 KisImageBarrierLockerWithFeedbackImplPrivate::blockWithFeedback(image); 0029 m_locker.reset(new InternalLocker(image)); 0030 } 0031 0032 ~KisImageBarrierLockerWithFeedbackImpl() { 0033 } 0034 0035 private: 0036 QScopedPointer<InternalLocker> m_locker; 0037 }; 0038 0039 /** 0040 * @brief KisImageBarrierLockerWithFeedback is a simple KisImageBarrierLocker with a 0041 * progress dialog feedback shown before locking. 0042 */ 0043 typedef KisImageBarrierLockerWithFeedbackImpl<KisImageBarrierLocker> KisImageBarrierLockerWithFeedback; 0044 0045 /** 0046 * @brief KisImageBarrierLockerWithFeedback is a simple KisImageBarrierLockerAllowEmpty with a 0047 * progress dialog feedback shown before locking. 0048 */ 0049 typedef KisImageBarrierLockerWithFeedbackImpl<KisImageBarrierLockerAllowNull> KisImageBarrierLockerWithFeedbackAllowNull; 0050 0051 0052 #endif // KISIMAGEBARRIERLOCKERWITHFEEDBACK_H