File indexing completed on 2025-03-09 04:06:54

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2017 Scott Petrovic <scottpetrovic@gmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 #ifndef KIS_PAINTOP_PRESETS_SAVE_H
0007 #define KIS_PAINTOP_PRESETS_SAVE_H
0008 
0009 #include <QWidget>
0010 #include <QDialog>
0011 
0012 #include "ui_wdgsavebrushpreset.h"
0013 #include "kis_canvas_resource_provider.h"
0014 #include "kis_favorite_resource_manager.h"
0015 
0016 class KisPaintOpPresetSaveDialog : public QDialog , public Ui::WdgSaveBrushPreset
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     KisPaintOpPresetSaveDialog(QWidget* parent) : QDialog(parent) {
0022         setupUi(this);
0023     }       
0024 };
0025 
0026 
0027 class KisPresetSaveWidget : public KisPaintOpPresetSaveDialog
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     KisPresetSaveWidget(QWidget* parent);
0033     virtual ~KisPresetSaveWidget();
0034 
0035     void showDialog();
0036 
0037     /// determines if we should show the save as dialog (true) or save in the background (false)
0038     void useNewBrushDialog(bool show);
0039 
0040     void scratchPadSetup(KisCanvasResourceProvider* resourceProvider);
0041     void saveScratchPadThumbnailArea(const QImage image);
0042     KisCanvasResourceProvider* m_resourceProvider {0};
0043 
0044     void setFavoriteResourceManager(KisFavoriteResourceManager * favManager);
0045 
0046 Q_SIGNALS:
0047     void resourceSelected(KoResourceSP resource);
0048 
0049 
0050 public Q_SLOTS:
0051 
0052     void loadImageFromFile();
0053     void savePreset();
0054     void loadScratchpadThumbnail();
0055     void loadExistingThumbnail();
0056     void loadImageFromLibrary();
0057 
0058 
0059 private:
0060     bool m_useNewBrushDialog {false};
0061     KisFavoriteResourceManager * m_favoriteResourceManager {0};
0062     QImage scratchPadThumbnailArea;
0063 };
0064 
0065 
0066 #endif