File indexing completed on 2024-05-19 04:29:05

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2008 Boudewijn Rempt <boud@valdyas.org>
0003  * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 #ifndef KIS_PAINTOP_SETTINGS_WIDGET_H
0008 #define KIS_PAINTOP_SETTINGS_WIDGET_H
0009 
0010 #include <kritaui_export.h>
0011 
0012 #include <brushengine/kis_paintop_config_widget.h>
0013 
0014 #include <lager/reader.hpp>
0015 #include "kis_paintop_option.h"
0016 
0017 class KisPropertiesConfiguration;
0018 class KisPaintOpConfigWidget;
0019 class KisPaintopLodLimitations;
0020 
0021 /**
0022  * A common widget for enabling/disabling and determining
0023  * the effect of tablet pressure, tilt and rotation and
0024  * other paintop settings.
0025  */
0026 class KRITAUI_EXPORT KisPaintOpSettingsWidget : public KisPaintOpConfigWidget
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031 
0032     KisPaintOpSettingsWidget(QWidget * parent = 0);
0033     ~KisPaintOpSettingsWidget() override;
0034 
0035     void addPaintOpOption(KisPaintOpOption *option);
0036     void addPaintOpOption(KisPaintOpOption *option, KisPaintOpOption::PaintopCategory category);
0037 
0038     /// Reimplemented
0039     void setConfiguration(const KisPropertiesConfigurationSP  config) override;
0040 
0041     /// Reimplemented
0042     void writeConfiguration(KisPropertiesConfigurationSP config) const override;
0043 
0044     KisPaintopLodLimitations lodLimitations() const override;
0045     lager::reader<KisPaintopLodLimitations> lodLimitationsReader() const override;
0046     lager::reader<qreal> effectiveBrushSize() const override;
0047 
0048     ///Reimplemented, sets image on option widgets
0049     void setImage(KisImageWSP image) override;
0050 
0051     ///Reimplemented, sets node on option widgets
0052     void setNode(KisNodeWSP node) override;
0053 
0054     void setResourcesInterface(KisResourcesInterfaceSP resourcesInterface) override;
0055     void setCanvasResourcesInterface(KoCanvasResourcesInterfaceSP canvasResourcesInterface) override;
0056 
0057 private Q_SLOTS:
0058 
0059     void changePage(const QModelIndex&);
0060     void lockProperties(const QModelIndex& index);
0061     void slotLockPropertiesDrop();
0062     void slotLockPropertiesSave();
0063     void slotEntryChecked(const QModelIndex &index);
0064 
0065 protected:
0066     void addPaintOpOption(KisPaintOpOption *option, QString category);
0067     virtual void notifyPageChanged();
0068     bool eventFilter(QObject *obj, QEvent *event) override;
0069 
0070 private:
0071     
0072     struct Private;
0073     Private* const m_d;
0074     bool m_saveLockedOption;
0075 
0076 };
0077 
0078 #endif