digiKam
albumselectors.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 : 2010-10-09
7  * Description : A widget to select Physical or virtual albums with combo-box
8  *
9  * Copyright (C) 2010-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_ALBUM_SELECTORS_H
26 #define DIGIKAM_ALBUM_SELECTORS_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 namespace Digikam
33 {
34 
35 class Album;
36 typedef QList<Album*> AlbumList;
37 
38 class AlbumSelectors : public QWidget
39 {
40  Q_OBJECT
41 
42 public:
43 
44  enum AlbumType
45  {
46  PhysAlbum = 0,
48  All
49  };
50 
52  {
55  };
56 
57 public:
58 
63  explicit AlbumSelectors(const QString& label,
64  const QString& configName,
65  QWidget* const parent = nullptr,
66  AlbumType albumType = All);
67  ~AlbumSelectors() override;
68 
72  AlbumList selectedAlbums() const;
73 
78 
82  AlbumList selectedTags() const;
83 
87  QList<int> selectedTagIds() const;
88 
93 
97  void resetPAlbumSelection();
98 
102  void resetTAlbumSelection();
103 
107  void resetSelection();
108 
112  void setAlbumSelected(Album* const album, SelectionType type);
113 
117  void setTagSelected(Album* const album, SelectionType type);
118 
122  void setTypeSelection(int albumType);
123 
127  int typeSelection() const;
128 
132  bool wholeAlbumsChecked() const;
133 
137  bool wholeTagsChecked() const;
138 
139 public Q_SLOTS:
140 
144  void loadState();
145 
149  void saveState();
150 
151 Q_SIGNALS:
152 
154 
155 private Q_SLOTS:
156 
157  void slotUpdateClearButtons();
158  void slotWholeAlbums(bool);
159  void slotWholeTags(bool);
160 
161 private:
162 
163  void initAlbumWidget();
164  void initTagWidget();
165  void updateTabText();
166 
167 private:
168 
169  class Private;
170  Private* const d;
171 };
172 
173 } // namespace Digikam
174 
175 #endif // DIGIKAM_ALBUM_SELECTORS_H
Definition: albumselectors.h:39
~AlbumSelectors() override
Definition: albumselectors.cpp:172
void saveState()
Definition: albumselectors.cpp:473
void setAlbumSelected(Album *const album, SelectionType type)
Definition: albumselectors.cpp:367
bool wholeTagsChecked() const
Definition: albumselectors.cpp:324
QList< int > selectedAlbumIds() const
Definition: albumselectors.cpp:311
bool wholeAlbumsChecked() const
Definition: albumselectors.cpp:290
void setTagSelected(Album *const album, SelectionType type)
Definition: albumselectors.cpp:381
void resetPAlbumSelection()
Definition: albumselectors.cpp:415
AlbumType
Definition: albumselectors.h:45
@ PhysAlbum
Definition: albumselectors.h:46
@ All
Definition: albumselectors.h:48
@ TagsAlbum
Definition: albumselectors.h:47
void setTypeSelection(int albumType)
Definition: albumselectors.cpp:395
AlbumList selectedAlbums() const
Definition: albumselectors.cpp:295
int typeSelection() const
Definition: albumselectors.cpp:403
AlbumSelectors(const QString &label, const QString &configName, QWidget *const parent=nullptr, AlbumType albumType=All)
Definition: albumselectors.cpp:119
SelectionType
Definition: albumselectors.h:52
@ SingleSelection
Definition: albumselectors.h:53
@ MultipleSelection
Definition: albumselectors.h:54
void resetSelection()
Definition: albumselectors.cpp:429
void resetTAlbumSelection()
Definition: albumselectors.cpp:422
void loadState()
Definition: albumselectors.cpp:442
QList< int > selectedTagIds() const
Definition: albumselectors.cpp:345
AlbumList selectedAlbumsAndTags() const
Definition: albumselectors.cpp:358
AlbumList selectedTags() const
Definition: albumselectors.cpp:329
Abstract base class for all album types.
Definition: album.h:67
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43
QList< Album * > AlbumList
Definition: album.h:50