Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPaletteEditor.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Michael Zhou <simeirxh@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISPALETTEMANAGER_H
8#define KISPALETTEMANAGER_H
9
10#include <QObject>
11#include <QScopedPointer>
12#include <KisSwatch.h>
13
14#include <kritaui_export.h>
15
16class KoColorSet;
17class KisPaletteModel;
18class KisViewManager;
19class KisSwatchGroup;
20class KisViewManager;
21
30class KRITAUI_EXPORT KisPaletteEditor : public QObject
31{
32 Q_OBJECT
33public:
34 struct PaletteInfo;
35
36public:
37 explicit KisPaletteEditor(QObject *parent = 0);
39
40 void setPaletteModel(KisPaletteModel *model);
41 void setView(KisViewManager *view);
42
43 KoColorSetSP addPalette();
44 KoColorSetSP importPalette();
45 void removePalette(KoColorSetSP );
46
52 int rowCountOfGroup(const QString &originalName) const;
53
59 QString oldNameFromNewName(const QString &newName) const;
60
65 void rename(const QString &newName);
66
70 void changeColumnCount(int);
71
76 QString addGroup();
77
83 bool removeGroup(const QString &name);
84
90 QString renameGroup(const QString &oldName);
91
97 void changeGroupRowCount(const QString &name, int newRowCount);
98
99 void setStorageLocation(QString location);
100
101 void setEntry(const KoColor &color, const QModelIndex &index);
102
103 void removeEntry(const QModelIndex &index);
104
105 void modifyEntry(const QModelIndex &index);
106
107 void addEntry(const KoColor &color);
108
109 bool isModified() const;
110
120 void startEditing();
126 void endEditing(bool applyChanges = true);
127 void clearStagedChanges();
128
132 void saveNewPaletteVersion();
133
134private Q_SLOTS:
135 void slotGroupNameChanged(const QString &newName);
136 void slotPaletteChanged();
137 void slotSetDocumentModified();
138
139private:
140 QString newGroupName() const;
141 bool duplicateExistsGroupName(const QString &name) const;
142 bool duplicateExistsOriginalGroupName(const QString &name) const;
143 QString filenameFromPath(const QString &path) const;
144
145private:
146 struct Private;
147 QScopedPointer<Private> m_d;
148};
149
150#endif // KISPALETTEMANAGER_H
The PaletteEditor class this class manipulates a KisPaletteModel using GUI elements and communicates ...
QScopedPointer< Private > m_d
The KisPaletteModel class This, together with KisPaletteView and KisPaletteDelegate forms a mvc way t...
The KisSwatchGroup class stores a matrix of color swatches swatches can accessed using (x,...