| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2000-12-05 |
| 7 |
* Description : helper class used to modify physical albums in views |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2009-2011 by Johannes Wienke <languitar at semipol dot de> |
| 10 |
* |
| 11 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 12 |
* |
| 13 |
* ============================================================ */ |
| 14 |
|
| 15 |
#pragma once |
| 16 |
|
| 17 |
// Qt includes |
| 18 |
|
| 19 |
#include <QObject> |
| 20 |
#include <QWidget> |
| 21 |
|
| 22 |
// Local includes |
| 23 |
|
| 24 |
#include "album.h" |
| 25 |
|
| 26 |
namespace Digikam |
| 27 |
{ |
| 28 |
|
| 29 |
/** |
| 30 |
* Utility class providing methods to modify physical albums (PAlbum) in a way |
| 31 |
* useful to implement views. |
| 32 |
* |
| 33 |
* @author jwienke |
| 34 |
*/ |
| 35 |
class AlbumModificationHelper : public QObject |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
|
| 41 |
/** |
| 42 |
* Constructor. |
| 43 |
* |
| 44 |
* @param parent the parent for qt parent child mechanism |
| 45 |
* @param dialogParent parent widget for dialogs displayed by this object |
| 46 |
*/ |
| 47 |
explicit AlbumModificationHelper(QObject* const parent, QWidget* const dialogParent); |
| 48 |
|
| 49 |
/** |
| 50 |
* Destructor. |
| 51 |
*/ |
| 52 |
~AlbumModificationHelper() override; |
| 53 |
|
| 54 |
/** |
| 55 |
* Sets the album that the given action operates on. |
| 56 |
* You must call bindTag and then connect the action's triggered |
| 57 |
* to the desired slot, slotTagNew(), slotTagEdit() or slotTagDelete(). |
| 58 |
* Note: Changes the Action's user data. |
| 59 |
*/ |
| 60 |
void bindAlbum(QAction* const action, PAlbum* const parent) const; |
| 61 |
|
| 62 |
/** |
| 63 |
* Returns the album bound with bindAlbum. The given QObject shall be |
| 64 |
* a QAction, but for convenience the given object |
| 65 |
* will be checked with qobject_cast first, so you can pass QObject::sender(). |
| 66 |
*/ |
| 67 |
PAlbum* boundAlbum(QObject* const action) const; |
| 68 |
|
| 69 |
public Q_SLOTS: |
| 70 |
|
| 71 |
/** |
| 72 |
* Creates a new album under the given parent. The user will be prompted for |
| 73 |
* the settings of the new album. |
| 74 |
* |
| 75 |
* @param parentAlbum parent album for the new one |
| 76 |
* @return the new album or 0 if no album was created |
| 77 |
*/ |
| 78 |
PAlbum* slotAlbumNew(PAlbum* parentAlbum); |
| 79 |
PAlbum* slotAlbumNew(); |
| 80 |
|
| 81 |
/** |
| 82 |
* Deletes the given album after waiting for a graphical confirmation of the |
| 83 |
* user. |
| 84 |
* |
| 85 |
* @param album the album to delete |
| 86 |
*/ |
| 87 |
void slotAlbumDelete(PAlbum* album); |
| 88 |
void slotAlbumDelete(); |
| 89 |
|
| 90 |
/** |
| 91 |
* Renames the given album. The user will be prompted for a new name. |
| 92 |
* |
| 93 |
* @param album the album to rename |
| 94 |
*/ |
| 95 |
void slotAlbumRename(PAlbum* album); |
| 96 |
void slotAlbumRename(); |
| 97 |
|
| 98 |
/** |
| 99 |
* Graphically edits the properties of the given album. |
| 100 |
* |
| 101 |
* @param album the album to edit |
| 102 |
*/ |
| 103 |
void slotAlbumEdit(PAlbum* album); |
| 104 |
void slotAlbumEdit(); |
| 105 |
|
| 106 |
void slotAlbumResetIcon(PAlbum* album); |
| 107 |
void slotAlbumResetIcon(); |
| 108 |
|
| 109 |
private: |
| 110 |
|
| 111 |
void addAlbumChildrenToList(QList<QUrl>& list, Album* const album); |
| 112 |
|
| 113 |
private: |
| 114 |
|
| 115 |
class Private; |
| 116 |
Private* const d = nullptr; |
| 117 |
}; |
| 118 |
|
| 119 |
} // namespace Digikam |