Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.4 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "KisImageConfigNotifier.h"

#include <QGlobalStatic>

#include <kis_debug.h>
#include "kis_signal_compressor.h"

Q_GLOBAL_STATIC(KisImageConfigNotifier, s_instance)

struct KisImageConfigNotifier::Private
{
    Private()
        : updateCompressor(300, KisSignalCompressor::FIRST_ACTIVE)
        , autoKeyframeUpdateCompressor(300, KisSignalCompressor::FIRST_ACTIVE)
    {}

    KisSignalCompressor updateCompressor;
    KisSignalCompressor autoKeyframeUpdateCompressor;
};

KisImageConfigNotifier::KisImageConfigNotifier()
    : m_d(new Private)
{
    connect(&m_d->updateCompressor, SIGNAL(timeout()), SIGNAL(configChanged()));
    connect(&m_d->updateCompressor, SIGNAL(timeout()), SIGNAL(autoKeyFrameConfigurationChanged()));
    connect(&m_d->autoKeyframeUpdateCompressor, SIGNAL(timeout()), SIGNAL(autoKeyFrameConfigurationChanged()));
}

KisImageConfigNotifier::~KisImageConfigNotifier()
{
}

KisImageConfigNotifier *KisImageConfigNotifier::instance()
{
    return s_instance;
}

void KisImageConfigNotifier::notifyConfigChanged()
{
    m_d->updateCompressor.start();
}

void KisImageConfigNotifier::notifyAutoKeyFrameConfigurationChanged()
{
    m_d->autoKeyframeUpdateCompressor.start();
}

void KisImageConfigNotifier::notifyGlobalProofingConfigChanged()
{
    Q_EMIT globalProofingConfigChanged();
}