Commit 953c522a authored by Eoin O'Neill's avatar Eoin O'Neill 🍀
Browse files

Changed compression value of save throttle for timeline zoom.

Original intent was to prevent the config saving from slowing down
zoom performance. While it worked, 5000MS (5 seconds) of required
inactivity made zoom saving unpredictable. A low value (now 100ms)
will prevent the configuration writing process from slowing down
zoom operation while preserving user settings even after a reboot
within 5 seconds of last zoom operation.

BUG:437025
parent 411297e6
Pipeline #80606 skipped with stage
......@@ -50,7 +50,7 @@ void KisAnimCurvesValuesHeader::setScale(qreal scale)
const qreal minimumScale = 0.001f;
m_d->scale = qMax(scale, minimumScale);
viewport()->update();
scaleChanged(m_d->scale);
emit scaleChanged(m_d->scale);
}
qreal KisAnimCurvesValuesHeader::scale() const
......
/*
* SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
* SPDX-FileCopyrightText: 2021 Eoin O'Neil <eoinoneill1991@gmail.com>
* SPDX-FileCopyrightText: 2021 Emmet O'Neill <emmetoneill.pdx@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -30,7 +32,7 @@ struct KisAnimTimelineTimeHeader::Private
, lastPressSectionIndex(-1)
{
// Compressed configuration writing..
const int compressorDelayMS = 5000;
const int compressorDelayMS = 100;
zoomSaveCompressor.reset(
new KisSignalCompressorWithParam<qreal>(compressorDelayMS,
[](qreal zoomValue){
......@@ -67,13 +69,6 @@ KisAnimTimelineTimeHeader::KisAnimTimelineTimeHeader(QWidget *parent)
setSectionResizeMode(QHeaderView::Fixed);
setDefaultSectionSize(18);
setMinimumSectionSize(8);
KisConfig cfg(true);
setZoom(cfg.timelineZoom());
connect(this, &KisAnimTimelineTimeHeader::sigZoomChanged, [this](qreal zoomValue){
m_d->zoomSaveCompressor->start(zoomValue);
});
}
KisAnimTimelineTimeHeader::~KisAnimTimelineTimeHeader()
......@@ -91,6 +86,8 @@ void KisAnimTimelineTimeHeader::setActionManager(KisActionManager *actionManager
{
m_d->actionMan = actionManager;
disconnect(this, &KisAnimTimelineTimeHeader::sigZoomChanged, this, &KisAnimTimelineTimeHeader::slotSaveThrottle);
if (actionManager) {
KisAction *action;
......@@ -135,6 +132,10 @@ void KisAnimTimelineTimeHeader::setActionManager(KisActionManager *actionManager
action = actionManager->createAction("paste_columns_from_clipboard");
connect(action, SIGNAL(triggered()), SIGNAL(sigPasteColumns()));
KisConfig cfg(true);
setZoom(cfg.timelineZoom());
connect(this, &KisAnimTimelineTimeHeader::sigZoomChanged, this, &KisAnimTimelineTimeHeader::slotSaveThrottle);
}
}
......@@ -271,6 +272,11 @@ void KisAnimTimelineTimeHeader::paintSpan(QPainter *painter, int userFrameId,
style->drawControl(QStyle::CE_HeaderLabel, &opt, painter, this);
}
void KisAnimTimelineTimeHeader::slotSaveThrottle(qreal value)
{
m_d->zoomSaveCompressor->start(value);
}
int KisAnimTimelineTimeHeader::Private::calcSpanWidth(const int sectionWidth) {
const int minWidth = 36;
......
/*
* SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
* SPDX-FileCopyrightText: 2021 Eoin O'Neil <eoinoneill1991@gmail.com>
* SPDX-FileCopyrightText: 2021 Emmet O'Neill <emmetoneill.pdx@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -56,6 +58,9 @@ private:
const QPalette &palette,
const QPen &gridPen) const;
public Q_SLOTS:
void slotSaveThrottle(qreal value);
Q_SIGNALS:
void sigInsertColumnLeft();
void sigInsertColumnRight();
......
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