File indexing completed on 2025-01-26 04:08:08
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Michael Zhou <simeirxh@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISDLGPALETTEEDITOR_H 0008 #define KISDLGPALETTEEDITOR_H 0009 0010 #include <QDialog> 0011 #include <QPointer> 0012 #include <QPair> 0013 #include <QScopedPointer> 0014 #include <QHash> 0015 #include <QSet> 0016 0017 #include <KoColorSet.h> 0018 0019 #include "kritaui_export.h" 0020 0021 class QAction; 0022 0023 class KoColorSet; 0024 class KisPaletteModel; 0025 class KisSwatchGroup; 0026 class KoDialog; 0027 class KisViewManager; 0028 0029 class KisPaletteEditor; 0030 class Ui_WdgDlgPaletteEditor; 0031 0032 /** 0033 * @brief The KisDlgPaletteEditor class 0034 * a dialog used by the palette docker to make modifications to a palette. 0035 * it automatically uploads all changes into the resource server when 0036 * the change is accepted 0037 */ 0038 class KRITAUI_EXPORT KisDlgPaletteEditor : public QDialog 0039 { 0040 Q_OBJECT 0041 public: 0042 explicit KisDlgPaletteEditor(); 0043 ~KisDlgPaletteEditor(); 0044 0045 public: 0046 void setPaletteModel(KisPaletteModel *); 0047 KoColorSetSP palette() const { return m_colorSet; } 0048 void setView(KisViewManager *); 0049 0050 private Q_SLOTS: 0051 void slotDelGroup(); 0052 void slotAddGroup(); 0053 void slotRenGroup(); 0054 0055 void slotGroupChosen(const QString &groupName); 0056 0057 void slotRowCountChanged(int); 0058 void slotSetGlobal(); 0059 0060 void slotNameChanged(); 0061 void slotColCountChanged(int); 0062 0063 void slotAccepted(); 0064 0065 private: 0066 QString oldNameFromNewName(const QString &newName) const; 0067 0068 private: 0069 QScopedPointer<Ui_WdgDlgPaletteEditor> m_ui; 0070 QScopedPointer<QAction> m_actAddGroup; 0071 QScopedPointer<QAction> m_actDelGroup; 0072 QScopedPointer<QAction> m_actRenGroup; 0073 QScopedPointer<KisPaletteEditor> m_paletteEditor; 0074 QSharedPointer<KoColorSet> m_colorSet; 0075 QString m_currentGroupOriginalName; 0076 0077 QPalette m_normalPalette; 0078 QPalette m_warnPalette; 0079 }; 0080 0081 #endif // KISKisDlgPaletteEditor_H