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++
2.3 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2007 Adrian Page <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */
#include "kis_config_notifier.h"

#include <QGlobalStatic>

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

Q_GLOBAL_STATIC(KisConfigNotifier, s_instance)

struct KisConfigNotifier::Private
{
    Private() : dropFramesModeCompressor(300, KisSignalCompressor::FIRST_ACTIVE) {}

    KisSignalCompressor dropFramesModeCompressor;
};

KisConfigNotifier::KisConfigNotifier()
    : m_d(new Private)
{
    connect(&m_d->dropFramesModeCompressor, SIGNAL(timeout()), SIGNAL(dropFramesModeChanged()));
}

KisConfigNotifier::~KisConfigNotifier()
{
    dbgRegistry << "deleting KisConfigNotifier";
}

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

void KisConfigNotifier::notifyConfigChanged(void)
{
    Q_EMIT configChanged();
}

void KisConfigNotifier::notifyDropFramesModeChanged()
{
    m_d->dropFramesModeCompressor.start();
}

void KisConfigNotifier::notifyPixelGridModeChanged()
{
    Q_EMIT pixelGridModeChanged();
}

void KisConfigNotifier::notifyColorHistoryModeChanged()
{
    Q_EMIT colorHistoryModeChanged();
}

void KisConfigNotifier::notifyTouchPaintingChanged()
{
    Q_EMIT touchPaintingChanged();
}

void KisConfigNotifier::notifyColorSamplerPreviewStyleChanged()
{
    Q_EMIT sigColorSamplerPreviewStyleChanged();
}

void KisConfigNotifier::notifyColorThemeChanged(const QString &filename)
{
    Q_EMIT signalColorThemeChanged(filename);
}

void KisConfigNotifier::notifyLongPressChanged(bool enabled)
{
    Q_EMIT sigLongPressChanged(enabled);
}

#ifdef Q_OS_ANDROID
void KisConfigNotifier::notifyUsePageUpDownMouseButtonEmulationWorkaroundChanged(bool enabled)
{
    Q_EMIT sigUsePageUpDownMouseButtonEmulationWorkaroundChanged(enabled);
}

void KisConfigNotifier::notifyUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged(bool enabled)
{
    Q_EMIT sigUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged(enabled);
}

void KisConfigNotifier::notifyUseIgnoreHistoricTabletEventsWorkaroundChanged(bool enabled)
{
    Q_EMIT sigUseIgnoreHistoricTabletEventsWorkaroundChanged(enabled);
}

void KisConfigNotifier::notifyHideTouchAndStylusCursorsWorkaroundChanged(bool enabled)
{
    Q_EMIT sigHideTouchAndStylusCursorsWorkaroundChanged(enabled);
}
#endif