File indexing completed on 2025-01-26 04:11:27
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "KisLightnessStrengthOptionWidget.h" 0007 0008 #include <QLabel> 0009 #include <QVBoxLayout> 0010 #include <KisLager.h> 0011 #include <KisStandardOptionData.h> 0012 0013 0014 struct KisLightnessStrengthOptionWidget::Private 0015 { 0016 Private(lager::reader<bool> lightnessModeEnabled) 0017 : warningLabelVisible{lightnessModeEnabled.map(std::logical_not{})} 0018 { 0019 } 0020 0021 lager::reader<bool> warningLabelVisible; 0022 }; 0023 0024 KisLightnessStrengthOptionWidget::KisLightnessStrengthOptionWidget(lager::cursor<KisLightnessStrengthOptionData> optionData, lager::reader<bool> lightnessModeEnabled) 0025 : KisCurveOptionWidget(optionData.zoom(kislager::lenses::to_base<KisCurveOptionDataCommon>), KisPaintOpOption::GENERAL, lightnessModeEnabled) 0026 , m_d(new Private(lightnessModeEnabled)) 0027 { 0028 QWidget* page = new QWidget; 0029 0030 QLabel *enabledLabel = new QLabel(i18n("Disabled: brush must be in Lightness mode for this option to apply"), page); 0031 enabledLabel->setEnabled(true); 0032 enabledLabel->setAlignment(Qt::AlignHCenter); 0033 0034 QVBoxLayout* pageLayout = new QVBoxLayout(page); 0035 pageLayout->setMargin(0); 0036 pageLayout->addWidget(enabledLabel); 0037 pageLayout->addWidget(configurationPage()); 0038 0039 m_d->warningLabelVisible.bind(std::bind(&QWidget::setVisible, enabledLabel, std::placeholders::_1)); 0040 0041 setConfigurationPage(page); 0042 } 0043 0044 KisLightnessStrengthOptionWidget::~KisLightnessStrengthOptionWidget() 0045 { 0046 }