File indexing completed on 2024-06-16 04:16:50
0001 /* 0002 * This file is part of Krita 0003 * 0004 * SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KIS_WDG_SEEXPR_PRESETS_SAVE_H 0010 #define KIS_WDG_SEEXPR_PRESETS_SAVE_H 0011 0012 #include <QDialog> 0013 #include <filter/kis_filter_configuration.h> 0014 #include <resources/KisSeExprScript.h> 0015 0016 #include "ui_wdgseexprsavepreset.h" 0017 0018 /** 0019 * Dialog for saving SeExpr presets. 0020 * 0021 * Based on Scott Petrovic's KisPaintOpPresetSaveDialog. 0022 */ 0023 class KisWdgSeExprSavePreset : public QDialog, public Ui::WdgSeExprSavePreset 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 KisWdgSeExprSavePreset(QWidget *parent) 0029 : QDialog(parent) 0030 { 0031 setupUi(this); 0032 } 0033 }; 0034 0035 class KisWdgSeExprPresetsSave : public KisWdgSeExprSavePreset 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 KisWdgSeExprPresetsSave(QWidget *parent); 0041 virtual ~KisWdgSeExprPresetsSave(); 0042 0043 void showDialog(); 0044 0045 /// determines if we should show the save as dialog (true) or save in the background (false) 0046 void useNewPresetDialog(bool show); 0047 0048 Q_SIGNALS: 0049 // Triggers after resource is saved 0050 void resourceSelected(KoResourceSP resource); 0051 0052 public Q_SLOTS: 0053 void setCurrentPreset(KisSeExprScriptSP resource); 0054 void setCurrentRenderConfiguration(KisFilterConfigurationSP config); 0055 void loadImageFromFile(); 0056 void savePreset(); 0057 void loadExistingThumbnail(); 0058 void renderScriptToThumbnail(); 0059 0060 private: 0061 bool m_useNewPresetDialog {false}; 0062 KisSeExprScriptSP m_currentPreset; 0063 KisFilterConfigurationSP m_currentConfiguration; 0064 }; 0065 0066 #endif