Commit 82d15cad authored by Dmitry Kazakov's avatar Dmitry Kazakov

Make tooltip for lazy frame creation show the current state

Conflicts:
	krita/plugins/extensions/dockers/animation/animation_docker.cpp
parent 19d4bcbb
......@@ -341,4 +341,8 @@ namespace KritaUtils
return flags;
}
QString KRITAIMAGE_EXPORT toLocalizedOnOff(bool value) {
return value ? i18n("on") : i18n("off");
}
}
......@@ -62,6 +62,8 @@ namespace KritaUtils
quint8 KRITAIMAGE_EXPORT mergeOpacity(quint8 opacity, quint8 parentOpacity);
QBitArray KRITAIMAGE_EXPORT mergeChannelFlags(const QBitArray &flags, const QBitArray &parentFlags);
QString KRITAIMAGE_EXPORT toLocalizedOnOff(bool value);
}
#endif /* __KRITA_UTILS_H */
......@@ -33,6 +33,7 @@
#include "kis_post_execution_undo_adapter.h"
#include "kis_keyframe_channel.h"
#include "kis_animation_utils.h"
#include "krita_utils.h"
#include "kis_image_config.h"
......@@ -90,7 +91,7 @@ AnimationDocker::AnimationDocker()
m_deleteKeyframeAction->setActivationFlags(KisAction::ACTIVE_LAYER);
m_animationWidget->btnDeleteKeyframe->setDefaultAction(m_deleteKeyframeAction);
m_lazyFrameAction = new KisAction("Lazy Frame Creation", m_animationWidget->btnLazyFrame);
m_lazyFrameAction = new KisAction(KisAnimationUtils::lazyFrameCreationActionName, m_animationWidget->btnLazyFrame);
m_lazyFrameAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
m_lazyFrameAction->setCheckable(true);
......@@ -403,9 +404,15 @@ void AnimationDocker::updateLazyFrameIcon()
{
KisImageConfig cfg;
m_lazyFrameAction->setIcon(cfg.lazyFrameCreationEnabled() ?
const bool value = cfg.lazyFrameCreationEnabled();
m_lazyFrameAction->setIcon(value ?
KisIconUtils::loadIcon("lazyframeOn") :
KisIconUtils::loadIcon("lazyframeOff"));
m_lazyFrameAction->setText(QString("%1 (%2)")
.arg(KisAnimationUtils::lazyFrameCreationActionName)
.arg(KritaUtils::toLocalizedOnOff(value)));
}
void AnimationDocker::slotUpdateIcons()
......
......@@ -31,6 +31,7 @@ namespace KisAnimationUtils {
const QString addFrameActionName = i18n("New Frame");
const QString duplicateFrameActionName = i18n("Copy Frame");
const QString removeFrameActionName = i18n("Remove Frame");
const QString lazyFrameCreationActionName = i18n("Lazy Frame Creation");
bool createKeyframeLazy(KisImageSP image, KisNodeSP node, int time, bool copy) {
KisKeyframeChannel *content =
......
......@@ -32,6 +32,7 @@ namespace KisAnimationUtils
extern const QString addFrameActionName;
extern const QString duplicateFrameActionName;
extern const QString removeFrameActionName;
extern const QString lazyFrameCreationActionName;
};
#endif /* __KIS_ANIMATION_UTILS_H */
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