File indexing completed on 2025-01-26 04:11:23

0001 /*
0002  *  SPDX-FileCopyrightText: 2005 Bart Coppens <kde@bartcoppens.be>
0003  *  SPDX-FileCopyrightText: 2013 Somsubhra Bairi <somsubhra.bairi@gmail.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 #ifndef KIS_CLIPBOARD_BRUSH_WIDGET_H
0008 #define KIS_CLIPBOARD_BRUSH_WIDGET_H
0009 
0010 #include <QObject>
0011 #include <QShowEvent>
0012 
0013 #include <KoResourceServer.h>
0014 
0015 #include <kis_types.h>
0016 #include <kis_brush.h>
0017 #include "ui_wdgclipboardbrush.h"
0018 
0019 const QString TEMPORARY_CLIPBOARD_BRUSH_FILENAME = "/tmp/temporaryClipboardBrush.gbr";
0020 const QString TEMPORARY_CLIPBOARD_BRUSH_NAME = "Temporary clipboard brush";
0021 const double DEFAULT_CLIPBOARD_BRUSH_SPACING = 0.25;
0022 
0023 class KisClipboard;
0024 class KoResource;
0025 
0026 class KisWdgClipboardBrush : public QDialog, public Ui::KisWdgClipboardBrush
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     KisWdgClipboardBrush(QWidget* parent) : QDialog(parent) {
0032         setupUi(this);
0033     }
0034 };
0035 
0036 class KisClipboardBrushWidget : public KisWdgClipboardBrush
0037 {
0038     Q_OBJECT
0039 public:
0040     KisClipboardBrushWidget(QWidget* parent, const QString& caption, KisImageWSP image);
0041     virtual ~KisClipboardBrushWidget();
0042 
0043 private Q_SLOTS:
0044     void slotCreateBrush();
0045     void slotSpacingChanged();
0046     void slotUpdateUseColorAsMask(bool useColorAsMask);
0047     void slotAddPredefined();
0048     void slotUpdateSaveButton();
0049     void slotClipboardContentChanged();
0050 
0051 protected:
0052     void showEvent(QShowEvent *) override;
0053 
0054 Q_SIGNALS:
0055     void sigNewPredefinedBrush(KoResourceSP );
0056 
0057 private:
0058     KisClipboard* m_clipboard;
0059     KisPaintDeviceSP pd;
0060     KisBrushSP m_brush;
0061     KoResourceServer<KisBrush> *m_rServer;
0062 };
0063 
0064 #endif // KIS_CLIPBOARD_BRUSH_WIDGET_H