Commit 37386604 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix saving of the multiple frames insertion/removal options to the config

parent e54fb7a2
......@@ -1411,17 +1411,20 @@ void TimelineFramesView::insertOrRemoveMultipleHoldFrames(bool insertion, bool e
const int count = QInputDialog::getInt(this,
i18nc("@title:window", "Insert or Remove Hold Frames"),
i18nc("@label:spinbox", "Enter number of frames"),
defaultNumberOfFramesToAdd(),
insertion ?
m_d->insertKeyframeDialog->defaultTimingOfAddedFrames() :
m_d->insertKeyframeDialog->defaultNumberOfHoldFramesToRemove(),
1, 10000, 1, &ok);
if (ok) {
if (insertion) {
setDefaultNumberOfFramesToAdd(count);
m_d->insertKeyframeDialog->setDefaultTimingOfAddedFrames(count);
insertOrRemoveHoldFrames(count, entireColumn);
} else {
setDefaultNumberOfFramesToRemove(count);
m_d->insertKeyframeDialog->setDefaultNumberOfHoldFramesToRemove(count);
insertOrRemoveHoldFrames(-count, entireColumn);
}
}
}
......@@ -1482,54 +1485,6 @@ void TimelineFramesView::slotPasteFrames(bool entireColumn)
}
}
int TimelineFramesView::defaultNumberOfFramesToAdd() const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
return cfg.readEntry("defaultNumberOfFramesToAdd", 1);
}
void TimelineFramesView::setDefaultNumberOfFramesToAdd(int value) const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
cfg.writeEntry("defaultNumberOfFramesToAdd", value);
}
int TimelineFramesView::defaultNumberOfColumnsToAdd() const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
return cfg.readEntry("defaultNumberOfColumnsToAdd", 1);
}
void TimelineFramesView::setDefaultNumberOfColumnsToAdd(int value) const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
cfg.writeEntry("defaultNumberOfColumnsToAdd", value);
}
int TimelineFramesView::defaultNumberOfFramesToRemove() const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
return cfg.readEntry("defaultNumberOfFramesToRemove", 1);
}
void TimelineFramesView::setDefaultNumberOfFramesToRemove(int value) const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
cfg.writeEntry("defaultNumberOfFramesToRemove", value);
}
int TimelineFramesView::defaultNumberOfColumnsToRemove() const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
return cfg.readEntry("defaultNumberOfColumnsToRemove", 1);
}
void TimelineFramesView::setDefaultNumberOfColumnsToRemove(int value) const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
cfg.writeEntry("defaultNumberOfColumnsToRemove", value);
}
bool TimelineFramesView::viewportEvent(QEvent *event)
{
if (event->type() == QEvent::ToolTip && model()) {
......
......@@ -161,18 +161,6 @@ private:
QModelIndexList calculateSelectionSpan(bool entireColumn, bool editableOnly = true) const;
int defaultNumberOfFramesToAdd() const;
void setDefaultNumberOfFramesToAdd(int value) const;
int defaultNumberOfColumnsToAdd() const;
void setDefaultNumberOfColumnsToAdd(int value) const;
int defaultNumberOfFramesToRemove() const;
void setDefaultNumberOfFramesToRemove(int value) const;
int defaultNumberOfColumnsToRemove() const;
void setDefaultNumberOfColumnsToRemove(int value) const;
protected:
QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index,
const QEvent *event) const override;
......
......@@ -29,6 +29,10 @@
#include <QFormLayout>
#include <klocalizedstring.h>
#include "KSharedConfig"
#include "KConfigGroup"
TimelineInsertKeyframeDialog::TimelineInsertKeyframeDialog(QWidget *parent) :
QDialog(parent)
{
......@@ -75,6 +79,11 @@ TimelineInsertKeyframeDialog::TimelineInsertKeyframeDialog(QWidget *parent) :
bool TimelineInsertKeyframeDialog::promptUserSettings(int &out_count, int &out_timing, TimelineDirection &out_direction)
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
frameCountSpinbox.setValue(cfg.readEntry("defaultNumberOfFramesToAdd", 1));
frameTimingSpinbox.setValue(defaultTimingOfAddedFrames());
rightAfter->setChecked(cfg.readEntry("addNewFramesToTheRight", true));
if (exec() == QDialog::Accepted) {
out_count = frameCountSpinbox.value();
out_timing = frameTimingSpinbox.value();
......@@ -84,7 +93,35 @@ bool TimelineInsertKeyframeDialog::promptUserSettings(int &out_count, int &out_t
out_direction = TimelineDirection::RIGHT;
}
cfg.writeEntry("defaultNumberOfFramesToAdd", out_count);
setDefaultTimingOfAddedFrames(out_timing);
cfg.writeEntry("addNewFramesToTheRight", rightAfter->isChecked());
return true;
}
return false;
}
int TimelineInsertKeyframeDialog::defaultTimingOfAddedFrames() const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
return cfg.readEntry("defaultTimingOfAddedFrames", 1);
}
void TimelineInsertKeyframeDialog::setDefaultTimingOfAddedFrames(int value)
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
cfg.writeEntry("defaultTimingOfAddedFrames", value);
}
int TimelineInsertKeyframeDialog::defaultNumberOfHoldFramesToRemove() const
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
return cfg.readEntry("defaultNumberOfHoldFramesToRemove", 1);
}
void TimelineInsertKeyframeDialog::setDefaultNumberOfHoldFramesToRemove(int value)
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("FrameActionsDefaultValues");
cfg.writeEntry("defaultNumberOfHoldFramesToRemove", value);
}
......@@ -40,6 +40,13 @@ public:
TimelineInsertKeyframeDialog(QWidget *parent = 0);
bool promptUserSettings(int &count, int &timing, TimelineDirection &out_direction);
int defaultTimingOfAddedFrames() const;
void setDefaultTimingOfAddedFrames(int value);
int defaultNumberOfHoldFramesToRemove() const;
void setDefaultNumberOfHoldFramesToRemove(int value);
};
#endif // __TIMELINE_INSERT_KEYFRAME_DIALOG_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