Debian Codegraph @

libs/ui/widgets/kis_preset_chooser.h

raw symbols SCIP
1 /*
2 * SPDX-FileCopyrightText: 2002 Patrick Julien <[email protected]>
3 * SPDX-FileCopyrightText: 2011 Silvio Heinrich <[email protected]>
4 * SPDX-FileCopyrightText: 2011 José Luis Vergara <[email protected]>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 #ifndef KIS_PRESET_CHOOSER_H_
9 #define KIS_PRESET_CHOOSER_H_
10
11 #include <QWidget>
12 #include <QPointer>
13
14 #include <KoResource.h>
15 #include <KoID.h>
16 #include "kis_signal_auto_connection.h"
17 #include "ResourceListViewModes.h"
18
19 class KoAbstractResourceServerAdapter;
20 class KisPresetDelegate;
21 class KisResourceItemChooser;
22
23
24 #include <kritaui_export.h>
25
26 /**
27 * A special type of item chooser that can contain extra widgets that show
28 * more information about the currently selected item. Reimplement update()
29 * to extract that information and fill the appropriate widgets.
30 */
31 class KRITAUI_EXPORT KisPresetChooser : public QWidget
32 {
33 Q_OBJECT
34
35 public:
36
37 KisPresetChooser(QWidget *parent = 0);
38 ~KisPresetChooser() override;
39
40 enum ViewMode {
41 THUMBNAIL, /// Shows thumbnails
42 DETAIL /// Shows thumbnails with text next to it
43 };
44
45 /// Sets a list of resources in the paintop list, when ever user press enter in the lineedit of paintop_presets_popup Class
46 void setViewMode(ViewMode mode);
47 void setViewModeToThumbnail();
48 void setViewModeToDetail();
49
50 void setCurrentResource(KoResourceSP resource);
51
52 KoResourceSP currentResource() const;
53
54 /// Sets the visibility of tagging klineEdits
55 void showTaggingBar(bool show);
56
57 KisResourceItemChooser *itemChooser();
58
59 void setPresetFilter(const QString& paintOpId);
60
61 /// get the base size for the icons. Used by the slider in the view options
62 int iconSize();
63
64 Q_SIGNALS:
65 void resourceSelected(KoResourceSP resource);
66 void resourceClicked(KoResourceSP resource);
67
68 public Q_SLOTS:
69 void updateViewSettings();
70
71 /// sets the icon size. Used by slider in view menu
72 void setIconSize(int newSize);
73
74 /// saves the icon size for the presets. called by the horizontal slider release event.
75 void saveIconSize();
76
77 /// Shows/hides brush names when KisResourceItemListView used by KisResourceItemChooser
78 /// changes it's ListViewMode.
79 /// If this method is removed then the Details view brush names will still be displayed when
80 /// KisResourceItemChooser is in horizontal layout.
81 void showHideBrushNames(ListViewMode newViewMode);
82
83 private Q_SLOTS:
84 void notifyConfigChanged();
85 void slotResourceWasSelected(KoResourceSP resource);
86 void slotCurrentPresetChanged();
87
88 private:
89 KisResourceItemChooser *m_chooser {0};
90 KisPresetDelegate* m_delegate {0};
91 ViewMode m_mode;
92
93 class PaintOpFilterModel;
94 QPointer<PaintOpFilterModel> m_paintOpFilterModel;
95
96 KisSignalAutoConnectionsStore m_currentPresetConnections;
97 };
98
99 #endif
100