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

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "KisImageConfigNotifier.h"
0008 
0009 #include <QGlobalStatic>
0010 
0011 #include <kis_debug.h>
0012 #include "kis_signal_compressor.h"
0013 
0014 Q_GLOBAL_STATIC(KisImageConfigNotifier, s_instance)
0015 
0016 struct KisImageConfigNotifier::Private
0017 {
0018     Private() : updateCompressor(300, KisSignalCompressor::FIRST_ACTIVE) {}
0019 
0020     KisSignalCompressor updateCompressor;
0021 };
0022 
0023 KisImageConfigNotifier::KisImageConfigNotifier()
0024     : m_d(new Private)
0025 {
0026     connect(&m_d->updateCompressor, SIGNAL(timeout()), SIGNAL(configChanged()));
0027 }
0028 
0029 KisImageConfigNotifier::~KisImageConfigNotifier()
0030 {
0031 }
0032 
0033 KisImageConfigNotifier *KisImageConfigNotifier::instance()
0034 {
0035     return s_instance;
0036 }
0037 
0038 void KisImageConfigNotifier::notifyConfigChanged()
0039 {
0040     m_d->updateCompressor.start();
0041 }