Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPresetChooser Class Reference

#include <kis_preset_chooser.h>

+ Inheritance diagram for KisPresetChooser:

Public Types

enum  ViewMode { THUMBNAIL , DETAIL }
 

Public Slots

void saveIconSize ()
 saves the icon size for the presets. called by the horizontal slider release event.
 
void setIconSize (int newSize)
 sets the icon size. Used by slider in view menu
 
void showHideBrushNames (ListViewMode newViewMode)
 
void updateViewSettings ()
 

Signals

void resourceClicked (KoResourceSP resource)
 
void resourceSelected (KoResourceSP resource)
 

Public Member Functions

KoResourceSP currentResource () const
 
int iconSize ()
 get the base size for the icons. Used by the slider in the view options
 
KisResourceItemChooseritemChooser ()
 
 KisPresetChooser (QWidget *parent=0)
 
void setCurrentResource (KoResourceSP resource)
 
void setPresetFilter (const QString &paintOpId)
 
void setViewMode (ViewMode mode)
 Sets a list of resources in the paintop list, when ever user press enter in the lineedit of paintop_presets_popup Class.
 
void setViewModeToDetail ()
 
void setViewModeToThumbnail ()
 
void showTaggingBar (bool show)
 Sets the visibility of tagging klineEdits.
 
 ~KisPresetChooser () override
 

Private Slots

void notifyConfigChanged ()
 
void slotCurrentPresetChanged ()
 
void slotResourceWasSelected (KoResourceSP resource)
 

Private Attributes

KisResourceItemChooserm_chooser {0}
 
KisSignalAutoConnectionsStore m_currentPresetConnections
 
KisPresetDelegatem_delegate {0}
 
ViewMode m_mode
 
QPointer< PaintOpFilterModel > m_paintOpFilterModel
 

Detailed Description

A special type of item chooser that can contain extra widgets that show more information about the currently selected item. Reimplement update() to extract that information and fill the appropriate widgets.

Definition at line 31 of file kis_preset_chooser.h.

Member Enumeration Documentation

◆ ViewMode

Enumerator
THUMBNAIL 
DETAIL 

Shows thumbnails.

Shows thumbnails with text next to it

Definition at line 40 of file kis_preset_chooser.h.

40 {
41 THUMBNAIL,
42 DETAIL
43 };
@ DETAIL
Shows thumbnails.

Constructor & Destructor Documentation

◆ KisPresetChooser()

KisPresetChooser::KisPresetChooser ( QWidget * parent = 0)

Definition at line 171 of file kis_preset_chooser.cpp.

172 : QWidget(parent)
173{
174 setObjectName("KisPresetChooser");
175
176 QVBoxLayout * layout = new QVBoxLayout(this);
177 layout->setContentsMargins(0, 0, 0, 0);
178
183 m_chooser->setSynced(true);
185 layout->addWidget(m_chooser);
186
189
191 this, SIGNAL(resourceSelected(KoResourceSP )));
193 this, SIGNAL(resourceClicked(KoResourceSP )));
194
196
198
199 connect(KisConfigNotifier::instance(), SIGNAL(configChanged()),
200 SLOT(notifyConfigChanged()));
201
202
204}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
static KisConfigNotifier * instance()
void slotResourceWasSelected(KoResourceSP resource)
void resourceSelected(KoResourceSP resource)
KisResourceItemChooser * m_chooser
KisPresetDelegate * m_delegate
void showHideBrushNames(ListViewMode newViewMode)
void resourceClicked(KoResourceSP resource)
The resource item delegate for rendering the resource preview.
void listViewModeChanged(ListViewMode newViewMode)
Emitted when the view mode for the internal KisResourceItemListView changes.
void setRowHeight(int rowHeight)
Sets the height of the view rows.
void setItemDelegate(QAbstractItemDelegate *delegate)
Sets a custom delegate for the view.
static KisResourceMetaDataModel * resourceMetadataModel()
const QString PaintOpPresets

References connect(), KisConfigNotifier::instance(), KisResourceItemChooser::listViewModeChanged(), m_chooser, m_delegate, m_mode, notifyConfigChanged(), ResourceType::PaintOpPresets, resourceClicked(), KisResourceModelProvider::resourceMetadataModel(), resourceSelected(), KisResourceItemChooser::setItemDelegate(), KisResourceItemChooser::setRowHeight(), KisResourceItemChooser::setSynced(), showHideBrushNames(), KisResourceItemChooser::showImportExportBtns(), slotResourceWasSelected(), and THUMBNAIL.

◆ ~KisPresetChooser()

KisPresetChooser::~KisPresetChooser ( )
override

Definition at line 206 of file kis_preset_chooser.cpp.

207{
208}

Member Function Documentation

◆ currentResource()

KoResourceSP KisPresetChooser::currentResource ( ) const

Definition at line 278 of file kis_preset_chooser.cpp.

279{
280 return m_chooser->currentResource();
281}

References KisResourceItemChooser::currentResource, and m_chooser.

◆ iconSize()

int KisPresetChooser::iconSize ( )

get the base size for the icons. Used by the slider in the view options

Definition at line 309 of file kis_preset_chooser.cpp.

References KisResourceItemChooserSync::baseLength, and KisResourceItemChooserSync::instance().

◆ itemChooser()

KisResourceItemChooser * KisPresetChooser::itemChooser ( )

Definition at line 288 of file kis_preset_chooser.cpp.

289{
290 return m_chooser;
291}

References m_chooser.

◆ notifyConfigChanged

void KisPresetChooser::notifyConfigChanged ( )
privateslot

Definition at line 226 of file kis_preset_chooser.cpp.

227{
228 KisConfig cfg(true);
229 m_delegate->setUseDirtyPresets(cfg.useDirtyPresets());
230 setIconSize(cfg.presetIconSize());
231}
void setIconSize(int newSize)
sets the icon size. Used by slider in view menu
void setUseDirtyPresets(bool value)

References m_delegate, KisConfig::presetIconSize(), setIconSize(), KisPresetDelegate::setUseDirtyPresets(), and KisConfig::useDirtyPresets().

◆ resourceClicked

void KisPresetChooser::resourceClicked ( KoResourceSP resource)
signal

◆ resourceSelected

void KisPresetChooser::resourceSelected ( KoResourceSP resource)
signal

◆ saveIconSize

void KisPresetChooser::saveIconSize ( )
slot

saves the icon size for the presets. called by the horizontal slider release event.

Definition at line 315 of file kis_preset_chooser.cpp.

316{
317 // save icon size
318 if (KisConfig(true).presetIconSize() != iconSize()) {
320 }
321}
void setPresetIconSize(const int value) const
int iconSize()
get the base size for the icons. Used by the slider in the view options

References iconSize(), and KisConfig::setPresetIconSize().

◆ setCurrentResource()

void KisPresetChooser::setCurrentResource ( KoResourceSP resource)

Definition at line 273 of file kis_preset_chooser.cpp.

274{
275 m_chooser->setCurrentResource(resource);
276}
void setCurrentResource(KoResourceSP resource)
Sets the item representing the resource as selected.

References m_chooser, and KisResourceItemChooser::setCurrentResource().

◆ setIconSize

void KisPresetChooser::setIconSize ( int newSize)
slot

sets the icon size. Used by slider in view menu

Definition at line 303 of file kis_preset_chooser.cpp.

304{
306 chooserSync->setBaseLength(newSize);
307}

References KisResourceItemChooserSync::instance(), and KisResourceItemChooserSync::setBaseLength().

◆ setPresetFilter()

void KisPresetChooser::setPresetFilter ( const QString & paintOpId)

Definition at line 293 of file kis_preset_chooser.cpp.

294{
295 QMap<QString, QVariant> metaDataFilter;
296 if (!paintOpId.isEmpty()) { // empty means "all"
297 metaDataFilter["paintopid"] = paintOpId;
298 }
299 m_chooser->tagFilterModel()->setMetaDataFilter(metaDataFilter);
301}
KisTagFilterResourceProxyModel * tagFilterModel() const
void setMetaDataFilter(QMap< QString, QVariant > metaDataMap)
setMetaDataFilter provides a set of metadata to filter on, for instance by paintop id category.

References m_chooser, KisTagFilterResourceProxyModel::setMetaDataFilter(), KisResourceItemChooser::tagFilterModel(), and updateViewSettings().

◆ setViewMode()

void KisPresetChooser::setViewMode ( KisPresetChooser::ViewMode mode)

Sets a list of resources in the paintop list, when ever user press enter in the lineedit of paintop_presets_popup Class.

Definition at line 210 of file kis_preset_chooser.cpp.

211{
212 m_mode = mode;
214}

References m_mode, and updateViewSettings().

◆ setViewModeToDetail()

void KisPresetChooser::setViewModeToDetail ( )

Definition at line 221 of file kis_preset_chooser.cpp.

222{
224}
void setViewMode(ViewMode mode)
Sets a list of resources in the paintop list, when ever user press enter in the lineedit of paintop_p...

References DETAIL, and setViewMode().

◆ setViewModeToThumbnail()

void KisPresetChooser::setViewModeToThumbnail ( )

Definition at line 216 of file kis_preset_chooser.cpp.

References setViewMode(), and THUMBNAIL.

◆ showHideBrushNames

void KisPresetChooser::showHideBrushNames ( ListViewMode newViewMode)
slot

Shows/hides brush names when KisResourceItemListView used by KisResourceItemChooser changes it's ListViewMode. If this method is removed then the Details view brush names will still be displayed when KisResourceItemChooser is in horizontal layout.

Definition at line 323 of file kis_preset_chooser.cpp.

324{
325 switch (newViewMode) {
327 m_delegate->setShowText(true);
328 break;
329 }
330 default: {
331 m_delegate->setShowText(false);
332 }
333 }
334}
void setShowText(bool showText)

References Detail, m_delegate, and KisPresetDelegate::setShowText().

◆ showTaggingBar()

void KisPresetChooser::showTaggingBar ( bool show)

Sets the visibility of tagging klineEdits.

Definition at line 283 of file kis_preset_chooser.cpp.

284{
286}

References m_chooser, and KisResourceItemChooser::showTaggingBar().

◆ slotCurrentPresetChanged

void KisPresetChooser::slotCurrentPresetChanged ( )
privateslot

◆ slotResourceWasSelected

void KisPresetChooser::slotResourceWasSelected ( KoResourceSP resource)
privateslot

Definition at line 233 of file kis_preset_chooser.cpp.

234{
236 if (!resource) return;
237
238 KisPaintOpPresetSP preset = resource.dynamicCast<KisPaintOpPreset>();
240
242 preset->updateProxy(), SIGNAL(sigSettingsChanged()),
243 this, SLOT(slotCurrentPresetChanged()));
244}
KisSignalAutoConnectionsStore m_currentPresetConnections
void addUniqueConnection(Sender sender, Signal signal, Receiver receiver, Method method)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References KisSignalAutoConnectionsStore::addUniqueConnection(), KisSignalAutoConnectionsStore::clear(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_currentPresetConnections, and slotCurrentPresetChanged().

◆ updateViewSettings

void KisPresetChooser::updateViewSettings ( )
slot

Member Data Documentation

◆ m_chooser

KisResourceItemChooser* KisPresetChooser::m_chooser {0}
private

Definition at line 89 of file kis_preset_chooser.h.

89{0};

◆ m_currentPresetConnections

KisSignalAutoConnectionsStore KisPresetChooser::m_currentPresetConnections
private

Definition at line 96 of file kis_preset_chooser.h.

◆ m_delegate

KisPresetDelegate* KisPresetChooser::m_delegate {0}
private

Definition at line 90 of file kis_preset_chooser.h.

90{0};

◆ m_mode

ViewMode KisPresetChooser::m_mode
private

Definition at line 91 of file kis_preset_chooser.h.

◆ m_paintOpFilterModel

QPointer<PaintOpFilterModel> KisPresetChooser::m_paintOpFilterModel
private

Definition at line 94 of file kis_preset_chooser.h.


The documentation for this class was generated from the following files: