digiKam
tagsactionmngr.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2011-01-24
7  * Description : Tags Action Manager
8  *
9  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_TAGS_ACTION_MNGR_H
25 #define DIGIKAM_TAGS_ACTION_MNGR_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QWidget>
31 
32 class KActionCollection;
33 
34 namespace Digikam
35 {
36 
37 class Album;
38 class ImageTagChangeset;
39 
40 class TagsActionMngr : public QObject
41 {
42  Q_OBJECT
43 
44 public:
45 
46  explicit TagsActionMngr(QWidget* const parent);
47  ~TagsActionMngr() override;
48 
55 
63  void registerLabelsActions(KActionCollection* const ac);
64 
65  void registerActionsToWidget(QWidget* const wdg);
66 
71 
76  void updateTagShortcut(int tagId, const QKeySequence& ks, bool delAction = true);
77 
78  QString ratingShortcutPrefix() const;
79  QString tagShortcutPrefix() const;
80  QString pickShortcutPrefix() const;
81  QString colorShortcutPrefix() const;
82 
84 
85 Q_SIGNALS:
86 
87  void signalShortcutPressed(const QString& shortcut, int val);
88 
89 private Q_SLOTS:
90 
94  void slotAlbumDeleted(Album*);
95 
99  void slotAssignFromShortcut();
100 
104  void slotTagActionChanged();
105 
106 private:
107 
108  bool createTagActionShortcut(int tagId);
109  bool removeTagActionShortcut(int tagId, bool delAction = true);
110 
111  bool createRatingActionShortcut(KActionCollection* const ac, int rating);
112  bool createPickLabelActionShortcut(KActionCollection* const ac, int pickId);
113  bool createColorLabelActionShortcut(KActionCollection* const ac, int colorId);
114 
115 private:
116 
117  static TagsActionMngr* m_defaultManager;
118 
119  class Private;
120  Private* const d;
121 };
122 
123 } // namespace Digikam
124 
125 #endif // DIGIKAM_TAGS_ACTION_MNGR_H
Abstract base class for all album types.
Definition: album.h:67
Definition: tagsactionmngr.h:41
QString colorShortcutPrefix() const
Definition: tagsactionmngr.cpp:152
void registerActionsToWidget(QWidget *const wdg)
Definition: tagsactionmngr.cpp:202
TagsActionMngr(QWidget *const parent)
Definition: tagsactionmngr.cpp:114
void registerTagsActionCollections()
Definition: tagsactionmngr.cpp:157
static TagsActionMngr * defaultManager()
Definition: tagsactionmngr.cpp:86
void updateTagShortcut(int tagId, const QKeySequence &ks, bool delAction=true)
Definition: tagsactionmngr.cpp:352
QString pickShortcutPrefix() const
Definition: tagsactionmngr.cpp:147
QString tagShortcutPrefix() const
Definition: tagsactionmngr.cpp:142
void signalShortcutPressed(const QString &shortcut, int val)
void registerLabelsActions(KActionCollection *const ac)
Definition: tagsactionmngr.cpp:178
QString ratingShortcutPrefix() const
Definition: tagsactionmngr.cpp:137
QList< KActionCollection * > actionCollections() const
Definition: tagsactionmngr.cpp:173
~TagsActionMngr() override
Definition: tagsactionmngr.cpp:127
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43