File indexing completed on 2024-06-09 04:24:19
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2008 Boudewijn Rempt <boud@valdyas.org> 0003 * SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 #ifndef KIS_DLG_GENERATORLAYER_H 0008 #define KIS_DLG_GENERATORLAYER_H 0009 0010 #include <QDialog> 0011 #include <QString> 0012 0013 class KisFilterConfiguration; 0014 class KisViewManager; 0015 0016 #include "ui_wdgdlggeneratorlayer.h" 0017 #include <generator/kis_generator.h> 0018 #include <kis_thread_safe_signal_compressor.h> 0019 0020 /** 0021 * Create a new generator layer 0022 */ 0023 class KisDlgGeneratorLayer : public QDialog 0024 { 0025 public: 0026 0027 Q_OBJECT 0028 0029 public: 0030 0031 /** 0032 * Create a new generator layer 0033 * @param defaultLayerName the proposed name for this layer 0034 * @param arg_view the view manager 0035 * @param parent the widget parent of this dialog 0036 * @param glayer optional generator layer for editing 0037 * @param previousConfig optional configuration of layer being edited. 0038 */ 0039 KisDlgGeneratorLayer(const QString &defaultLayerName, KisViewManager *arg_view, 0040 QWidget *parent, 0041 KisGeneratorLayerSP glayer, 0042 const KisFilterConfigurationSP previousConfig, 0043 const KisStrokeId stroke); 0044 ~KisDlgGeneratorLayer() override; 0045 0046 void setConfiguration(const KisFilterConfigurationSP config); 0047 KisFilterConfigurationSP configuration() const; 0048 QString layerName() const; 0049 0050 protected Q_SLOTS: 0051 void slotNameChanged(const QString &); 0052 void previewGenerator(); 0053 void slotDelayedPreviewGenerator(); 0054 void saveLayer(); 0055 void restoreLayer(); 0056 0057 private: 0058 Ui_WdgDlgGeneratorLayer dlgWidget; 0059 KisGeneratorLayerSP layer; 0060 KisFilterConfigurationSP configBefore; 0061 KisViewManager *m_view; 0062 bool isEditing; 0063 0064 bool m_customName; 0065 bool m_freezeName; 0066 KisStrokeId m_stroke; 0067 KisThreadSafeSignalCompressor m_compressor; 0068 QWeakPointer<boost::none_t> m_updateCookie; 0069 }; 0070 0071 #endif