File indexing completed on 2024-12-22 04:16:04
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "KisSmudgeLengthOptionModel.h" 0007 0008 #include <KisLager.h> 0009 0010 namespace { 0011 CheckBoxState calcUseNewEngineState(bool useNewEngine, bool forceUseNewEngine) { 0012 return {useNewEngine || forceUseNewEngine, !forceUseNewEngine}; 0013 } 0014 } 0015 0016 KisSmudgeLengthOptionModel::KisSmudgeLengthOptionModel(lager::cursor<KisSmudgeLengthOptionMixIn> optionData, 0017 lager::reader<bool> forceUseNewEngine) 0018 : optionData(optionData) 0019 , LAGER_QT(mode) {optionData[&KisSmudgeLengthOptionMixIn::mode].zoom(kislager::lenses::do_static_cast<KisSmudgeLengthOptionMixIn::Mode, int>)} 0020 , LAGER_QT(smearAlpha) {optionData[&KisSmudgeLengthOptionMixIn::smearAlpha]} 0021 , LAGER_QT(useNewEngine) {optionData[&KisSmudgeLengthOptionMixIn::useNewEngine]} 0022 , LAGER_QT(useNewEngineState) { 0023 lager::with(optionData[&KisSmudgeLengthOptionMixIn::useNewEngine], 0024 forceUseNewEngine) 0025 .map(&calcUseNewEngineState)} 0026 { 0027 } 0028 0029 KisSmudgeLengthOptionMixIn KisSmudgeLengthOptionModel::backedOptionData() const 0030 { 0031 KisSmudgeLengthOptionMixIn data = optionData.get(); 0032 data.useNewEngine = useNewEngineState().value; 0033 return data; 0034 }