digiKam
tagspopupmenu.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 : 2004-09-07
7  * Description : a pop-up menu implementation to display a
8  * hierarchical view of digiKam tags.
9  *
10  * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
11  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  * Copyright (C) 2006-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_TAGS_POPUP_MENU_H
28 #define DIGIKAM_TAGS_POPUP_MENU_H
29 
30 // Qt includes
31 
32 #include <QList>
33 #include <QMenu>
34 
35 namespace Digikam
36 {
37 
38 class Album;
39 class TAlbum;
40 
41 class TagsPopupMenu : public QMenu
42 {
43  Q_OBJECT
44 
45 public:
46 
47  enum Mode
48  {
49  ASSIGN = 0,
53  };
54 
55 public:
56 
57  TagsPopupMenu(qlonglong selectedImageId, Mode mode, QWidget* const parent = nullptr);
58  TagsPopupMenu(const QList<qlonglong>& selectedImageIDs, Mode mode, QWidget* const parent = nullptr);
59  ~TagsPopupMenu() override;
60 
61 Q_SIGNALS:
62 
63  void signalTagActivated(int id);
65 
66 private Q_SLOTS:
67 
68  void slotAboutToShow();
69  void slotToggleTag(QAction*);
70  void slotAddTag(QAction*);
71  void slotTagThumbnail(Album*, const QPixmap&);
72 
73 private:
74 
75  void setup(Mode mode);
76  void clearPopup();
77  QMenu* buildSubMenu(int tagid);
78  void iterateAndBuildMenu(QMenu* menu, TAlbum* album);
79  void buildFlatMenu(QMenu* menu);
80  void setAlbumIcon(QAction* action, TAlbum* album);
81 
82 private:
83 
84  class Private;
85  Private* const d;
86 };
87 
88 } // namespace Digikam
89 
90 #endif // DIGIKAM_TAGS_POPUP_MENU_H
Abstract base class for all album types.
Definition: album.h:67
Definition: album.h:420
Definition: tagspopupmenu.h:42
Mode
Definition: tagspopupmenu.h:48
@ REMOVE
Definition: tagspopupmenu.h:50
@ RECENTLYASSIGNED
Definition: tagspopupmenu.h:52
@ DISPLAY
Used by "GoTo Tag" feature.
Definition: tagspopupmenu.h:51
@ ASSIGN
Definition: tagspopupmenu.h:49
TagsPopupMenu(qlonglong selectedImageId, Mode mode, QWidget *const parent=nullptr)
Definition: tagspopupmenu.cpp:438
void signalTagActivated(int id)
~TagsPopupMenu() override
Definition: tagspopupmenu.cpp:482
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43