File indexing completed on 2024-05-19 04:26:15
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_IDLE_WATCHER_H 0008 #define __KIS_IDLE_WATCHER_H 0009 0010 #include "kritaimage_export.h" 0011 0012 #include <QScopedPointer> 0013 #include <QObject> 0014 #include <QString> 0015 0016 #include "kis_types.h" 0017 0018 0019 class KRITAIMAGE_EXPORT KisIdleWatcher : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 KisIdleWatcher(int delay = 200, QObject* parent = 0); 0024 ~KisIdleWatcher() override; 0025 0026 bool isIdle() const; 0027 bool isCounting() const; 0028 0029 void setTrackedImages(const QVector<KisImageSP> &images); 0030 void setTrackedImage(KisImageSP image); 0031 0032 //Force to image modified state and start countdown to event 0033 void forceImageModified() { slotImageModified(); } 0034 void restartCountdown(); 0035 void triggerCountdownNoDelay(); 0036 0037 Q_SIGNALS: 0038 void startedIdleMode(); 0039 void imageModified(); 0040 0041 private Q_SLOTS: 0042 void slotImageModified(); 0043 void slotIdleCheckTick(); 0044 0045 void startIdleCheck(); 0046 void stopIdleCheck(); 0047 0048 private: 0049 struct Private; 0050 const QScopedPointer<Private> m_d; 0051 }; 0052 0053 #endif /* __KIS_IDLE_WATCHER_H */