File indexing completed on 2024-05-19 04:24:18

0001 /*
0002  *  SPDX-FileCopyrightText: 2023 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #include "KisCumulativeUndoData.h"
0007 
0008 #include <kconfiggroup.h>
0009 #include <kis_debug.h>
0010 
0011 const KisCumulativeUndoData KisCumulativeUndoData::defaultValue;
0012 
0013 bool KisCumulativeUndoData::read(const KConfigGroup *config)
0014 {
0015     excludeFromMerge = config->readEntry("cumulativeUndoExcludeFromMerge",
0016                                              defaultValue.excludeFromMerge);
0017     mergeTimeout = config->readEntry("cumulativeUndoMergeTimeout",
0018                                          defaultValue.mergeTimeout);
0019     maxGroupSeparation = config->readEntry("cumulativeUndoMaxGroupSeparation",
0020                                               defaultValue.maxGroupSeparation);
0021     maxGroupDuration = config->readEntry("cumulativeUndoMaxGroupDuration",
0022                                             defaultValue.maxGroupDuration);
0023 
0024     return true;
0025 }
0026 
0027 void KisCumulativeUndoData::write(KConfigGroup *config) const
0028 {
0029     config->writeEntry("cumulativeUndoExcludeFromMerge", excludeFromMerge);
0030     config->writeEntry("cumulativeUndoMergeTimeout", mergeTimeout);
0031     config->writeEntry("cumulativeUndoMaxGroupSeparation", maxGroupSeparation);
0032     config->writeEntry("cumulativeUndoMaxGroupDuration", maxGroupDuration);
0033 }
0034 
0035 QDebug KRITACOMMAND_EXPORT operator<<(QDebug dbg, const KisCumulativeUndoData &data)
0036 {
0037     dbg.nospace() << "KisCumulativeUndoData(";
0038     dbg.space() << ppVar(data.excludeFromMerge);
0039     dbg.space() << ppVar(data.mergeTimeout);
0040     dbg.space() << ppVar(data.maxGroupSeparation);
0041     dbg.space() << ppVar(data.maxGroupDuration);
0042     dbg.nospace() << ")";
0043 
0044     return dbg.nospace();
0045 }