Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_bookmarked_configurations_editor.cc
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8#include "ui_wdgbookmarkedconfigurationseditor.h"
9
11
17
18
20{
21 d->editorUi.setupUi(this);
22 d->model = model;
23 d->currentConfig = currentConfig;
24 d->editorUi.listConfigurations->setModel(d->model);
25 connect(d->editorUi.pushButtonClose, SIGNAL(pressed()), SLOT(accept()));
26
27 connect(d->editorUi.listConfigurations->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
28 this, SLOT(currentConfigChanged(QItemSelection,QItemSelection)));
29 currentConfigChanged(d->editorUi.listConfigurations->selectionModel()->selection(),
30 d->editorUi.listConfigurations->selectionModel()->selection());
31
32 connect(d->editorUi.pushButtonDelete, SIGNAL(pressed()), SLOT(deleteConfiguration()));
33 connect(d->editorUi.pushButtonBookmarkCurrent, SIGNAL(pressed()), SLOT(addCurrentConfiguration()));
34
35 if (!d->currentConfig) {
36 d->editorUi.pushButtonBookmarkCurrent->setEnabled(false);
37 }
38}
39
44
45void KisBookmarkedConfigurationsEditor::currentConfigChanged(const QItemSelection& selected, const QItemSelection&)
46{
47 if (d->model) {
48 d->editorUi.pushButtonDelete->setEnabled(!(selected.indexes().isEmpty()) ?
49 d->model->isIndexDeletable(selected.indexes().first()) :
50 false);
51 }
52}
53
55{
56 if (d->model) {
57 d->model->newConfiguration(ki18n("New configuration %1"), d->currentConfig);
58 }
59}
60
62{
63 if (d->model) {
64 d->model->deleteIndex(d->editorUi.listConfigurations->currentIndex());
65 }
66}
67
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void currentConfigChanged(const QItemSelection &selected, const QItemSelection &)
KisBookmarkedConfigurationsEditor(QWidget *parent, KisBookmarkedConfigurationsModel *manager, const KisSerializableConfigurationSP currentConfig)
virtual void newConfiguration(KLocalizedString baseName, const KisSerializableConfigurationSP config)
virtual void deleteIndex(const QModelIndex &index)
virtual bool isIndexDeletable(const QModelIndex &index) const