|
Krita Source Code Documentation
|
The PaletteEditor class this class manipulates a KisPaletteModel using GUI elements and communicates with KisDocument. More...
#include <KisPaletteEditor.h>
Inheritance diagram for KisPaletteEditor:Classes | |
| struct | PaletteInfo |
| struct | Private |
Public Member Functions | |
| void | addEntry (const KoColor &color) |
| QString | addGroup () |
| Stage the addition of a new swatch group. | |
| KoColorSetSP | addPalette () |
| void | changeColumnCount (int) |
| Stage a change of the palette's column count. | |
| void | changeGroupRowCount (const QString &name, int newRowCount) |
| Stage a change to the row count of a group. | |
| void | clearStagedChanges () |
| void | endEditing (bool applyChanges=true) |
| End editing and either apply or discard staged changes. | |
| KoColorSetSP | importPalette () |
| bool | isModified () const |
| KisPaletteEditor (QObject *parent=0) | |
| void | modifyEntry (const QModelIndex &index) |
| QString | oldNameFromNewName (const QString &newName) const |
| oldNameFromNewName | |
| void | removeEntry (const QModelIndex &index) |
| bool | removeGroup (const QString &name) |
| Stage the removal of a group. | |
| void | removePalette (KoColorSetSP) |
| void | rename (const QString &newName) |
| Stage a palette rename. | |
| QString | renameGroup (const QString &oldName) |
| Stage a rename of a group. | |
| int | rowCountOfGroup (const QString &originalName) const |
| rowCountOfGroup | |
| void | saveNewPaletteVersion () |
| saveNewPaletteVersion | |
| void | setEntry (const KoColor &color, const QModelIndex &index) |
| void | setPaletteModel (KisPaletteModel *model) |
| void | setStorageLocation (QString location) |
| void | setView (KisViewManager *view) |
| void | startEditing () |
| Start editing the current palette. | |
| ~KisPaletteEditor () | |
Private Slots | |
| void | slotGroupNameChanged (const QString &newName) |
| void | slotPaletteChanged () |
| void | slotSetDocumentModified () |
Private Member Functions | |
| bool | duplicateExistsGroupName (const QString &name) const |
| bool | duplicateExistsOriginalGroupName (const QString &name) const |
| QString | filenameFromPath (const QString &path) const |
| QString | newGroupName () const |
Private Attributes | |
| QScopedPointer< Private > | m_d |
The PaletteEditor class this class manipulates a KisPaletteModel using GUI elements and communicates with KisDocument.
Changes made in this class won't be done to the palette if the palette is read only (not editable, isEditable() == false)
Definition at line 30 of file KisPaletteEditor.h.
|
explicit |
Definition at line 62 of file KisPaletteEditor.cpp.
References KoResourceServerProvider::instance(), m_d, and KoResourceServerProvider::paletteServer.
| KisPaletteEditor::~KisPaletteEditor | ( | ) |
Definition at line 70 of file KisPaletteEditor.cpp.
Definition at line 430 of file KisPaletteEditor.cpp.
References KisColorButton::color, m_d, KisColorButton::setColor(), KisSwatch::setColor(), KisSwatch::setId(), KisSwatch::setName(), and KisSwatch::setSpotColor().
| QString KisPaletteEditor::addGroup | ( | ) |
Stage the addition of a new swatch group.
Definition at line 235 of file KisPaletteEditor.cpp.
References connect(), duplicateExistsGroupName(), duplicateExistsOriginalGroupName(), m_d, newGroupName(), and slotGroupNameChanged().
| KoColorSetSP KisPaletteEditor::addPalette | ( | ) |
Definition at line 90 of file KisPaletteEditor.cpp.
References KisResourceUserOperations::addResourceWithUserInput(), KoColorSet::GPL, KoColorSet::KPL, and m_d.
| void KisPaletteEditor::changeColumnCount | ( | int | newCount | ) |
Stage a change of the palette's column count.
Definition at line 227 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::changeGroupRowCount | ( | const QString & | name, |
| int | newRowCount ) |
Stage a change to the row count of a group.
| name | |
| newRowCount |
Definition at line 336 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::clearStagedChanges | ( | ) |
|
private |
Definition at line 194 of file KisPaletteEditor.cpp.
References m_d.
|
private |
Definition at line 203 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::endEditing | ( | bool | applyChanges = true | ) |
End editing and either apply or discard staged changes.
| applyChanges | If set to false, the palette remains unchanged and staged changes are discarded. |
Definition at line 519 of file KisPaletteEditor.cpp.
References clearStagedChanges(), KisPaletteEditor::PaletteInfo::columnCount, KisPaletteEditor::PaletteInfo::groups, m_d, KisPaletteEditor::PaletteInfo::name, newGroupName(), palette, and KisResourceUserOperations::renameResourceWithUserInput().
|
private |
Definition at line 625 of file KisPaletteEditor.cpp.
| KoColorSetSP KisPaletteEditor::importPalette | ( | ) |
Definition at line 138 of file KisPaletteEditor.cpp.
References KisResourceUserOperations::importResourceFileWithUserInput(), m_d, KoFileDialog::OpenFile, palette, and ResourceType::Palettes.
| bool KisPaletteEditor::isModified | ( | ) | const |
Definition at line 485 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::modifyEntry | ( | const QModelIndex & | index | ) |
Definition at line 385 of file KisPaletteEditor.cpp.
References KisSwatch::color(), KisColorButton::color, endEditing(), KisSwatch::id(), KisPaletteModel::IsGroupNameRole, m_d, KisSwatch::name(), renameGroup(), KisColorButton::setColor(), KisSwatch::setColor(), KisSwatch::setId(), KisSwatch::setName(), KisSwatch::setSpotColor(), KisSwatch::spotColor(), and startEditing().
|
private |
Definition at line 614 of file KisPaletteEditor.cpp.
References m_d.
| QString KisPaletteEditor::oldNameFromNewName | ( | const QString & | newName | ) | const |
oldNameFromNewName
| newName | the current name of a group |
Definition at line 208 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::removeEntry | ( | const QModelIndex & | index | ) |
Definition at line 371 of file KisPaletteEditor.cpp.
References endEditing(), KisPaletteModel::GroupNameRole, KisPaletteModel::IsGroupNameRole, m_d, removeGroup(), and startEditing().
| bool KisPaletteEditor::removeGroup | ( | const QString & | name | ) |
Stage the removal of a group.
| name | original group name |
Definition at line 270 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::removePalette | ( | KoColorSetSP | cs | ) |
| void KisPaletteEditor::rename | ( | const QString & | newName | ) |
Stage a palette rename.
| newName |
Definition at line 218 of file KisPaletteEditor.cpp.
References m_d.
| QString KisPaletteEditor::renameGroup | ( | const QString & | oldName | ) |
Stage a rename of a group.
| oldName |
Definition at line 291 of file KisPaletteEditor.cpp.
References connect(), duplicateExistsGroupName(), KoColorSet::GLOBAL_GROUP_NAME, m_d, and slotGroupNameChanged().
| int KisPaletteEditor::rowCountOfGroup | ( | const QString & | originalName | ) | const |
rowCountOfGroup
| originalName | the original name of a group at the creation of the instance |
Definition at line 176 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::saveNewPaletteVersion | ( | ) |
saveNewPaletteVersion
Definition at line 581 of file KisPaletteEditor.cpp.
References dbgResources, m_d, KisResourceStorage::Memory, KisStorageModel::storageForId(), KisAbstractResourceModel::StorageId, and KisResourceUserOperations::updateResourceWithUserInput().
Definition at line 351 of file KisPaletteEditor.cpp.
References m_d, KisSwatch::setId(), and KisSwatch::setName().
| void KisPaletteEditor::setPaletteModel | ( | KisPaletteModel * | model | ) |
Definition at line 73 of file KisPaletteEditor.cpp.
References connect(), m_d, slotPaletteChanged(), and slotSetDocumentModified().
| void KisPaletteEditor::setStorageLocation | ( | QString | location | ) |
Definition at line 346 of file KisPaletteEditor.cpp.
References m_d.
| void KisPaletteEditor::setView | ( | KisViewManager * | view | ) |
|
privateslot |
Definition at line 320 of file KisPaletteEditor.cpp.
References duplicateExistsGroupName(), m_d, and KoDialog::Ok.
|
privateslot |
Definition at line 608 of file KisPaletteEditor.cpp.
References clearStagedChanges(), and m_d.
|
privateslot |
Definition at line 362 of file KisPaletteEditor.cpp.
References m_d, and KisResourceUserOperations::updateResourceWithUserInput().
| void KisPaletteEditor::startEditing | ( | ) |
Start editing the current palette.
This must be called before any calls that stage changes, otherwise those calls have no effect. All staged changes get applied when calling endEditing().
Adding, removing and updating swatches happens immediately
Definition at line 494 of file KisPaletteEditor.cpp.
References clearStagedChanges(), m_d, and palette.
|
private |
Definition at line 147 of file KisPaletteEditor.h.