Commit 78e44a65 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Add ability to configure Lazy Frame Creation

Conflicts:
	krita/image/kis_image_config.cpp
parent b323d772
......@@ -33,13 +33,16 @@
#include <errno.h>
#endif
KisImageConfig::KisImageConfig()
: m_config( KSharedConfig::openConfig()->group(""))
KisImageConfig::KisImageConfig(bool readOnly)
: m_config( KSharedConfig::openConfig()->group("")),
m_readOnly(readOnly)
{
}
KisImageConfig::~KisImageConfig()
{
if (m_readOnly) return;
if (qApp->thread() != QThread::currentThread()) {
dbgKrita << "WARNING: KisImageConfig: requested config synchronization from nonGUI thread! Skipping...";
return;
......@@ -272,6 +275,17 @@ void KisImageConfig::setOnionSkinTintColorForward(const QColor &value)
m_config.writeEntry("oninSkinTintColorForward", value);
}
bool KisImageConfig::lazyFrameCreationEnabled(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("lazyFrameCreationEnabled", true) : true;
}
void KisImageConfig::setLazyFrameCreationEnabled(bool value)
{
m_config.writeEntry("lazyFrameCreationEnabled", value);
}
#if defined Q_OS_LINUX
#include <sys/sysinfo.h>
......
......@@ -26,7 +26,7 @@
class KRITAIMAGE_EXPORT KisImageConfig
{
public:
KisImageConfig();
KisImageConfig(bool readOnly = false);
~KisImageConfig();
bool enableProgressReporting(bool requestDefault = false) const;
......@@ -92,11 +92,15 @@ public:
QColor onionSkinTintColorForward() const;
void setOnionSkinTintColorForward(const QColor &value);
bool lazyFrameCreationEnabled(bool requestDefault = false) const;
void setLazyFrameCreationEnabled(bool value);
private:
Q_DISABLE_COPY(KisImageConfig)
private:
KConfigGroup m_config;
bool m_readOnly;
};
......
......@@ -76,11 +76,15 @@ KisTransactionData::KisTransactionData(const KUndo2MagicString& name, KisPaintDe
}
#include "kis_raster_keyframe_channel.h"
#include "kis_image_config.h"
void KisTransactionData::Private::tryCreateNewFrame(KisPaintDeviceSP device, int time)
{
if (!device->framesInterface()) return;
KisImageConfig cfg(true);
if (!cfg.lazyFrameCreationEnabled()) return;
KisRasterKeyframeChannel *channel = device->keyframeChannel();
KIS_ASSERT_RECOVER(channel) { return; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment