| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2009-26-02 |
| 7 |
* Description : a widget to select a physical album |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2009-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 10 |
* SPDX-FileCopyrightText: 2009-2010 by Johannes Wienke <languitar at semipol dot de> |
| 11 |
* |
| 12 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 13 |
* |
| 14 |
* ============================================================ */ |
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
// Qt includes |
| 19 |
|
| 20 |
#include <QWidget> |
| 21 |
|
| 22 |
// Local includes |
| 23 |
|
| 24 |
#include "albummanager.h" |
| 25 |
#include "albumtreeview.h" |
| 26 |
#include "searchtextbardb.h" |
| 27 |
|
| 28 |
class QTreeWidget; |
| 29 |
|
| 30 |
namespace Digikam |
| 31 |
{ |
| 32 |
|
| 33 |
class PAlbum; |
| 34 |
class AlbumModificationHelper; |
| 35 |
|
| 36 |
/** |
| 37 |
* Enables a simple context menu only for creating a new album. |
| 38 |
* |
| 39 |
* @author jwienke |
| 40 |
*/ |
| 41 |
class AlbumSelectTreeView: public AlbumTreeView |
| 42 |
{ |
| 43 |
Q_OBJECT |
| 44 |
|
| 45 |
public: |
| 46 |
|
| 47 |
/** |
| 48 |
* Constructor. |
| 49 |
* |
| 50 |
* @param model album model to work with |
| 51 |
* @param albumModificationHelper helper object for modifying albums |
| 52 |
* @param parent the parent for Qt's parent child mechanism |
| 53 |
*/ |
| 54 |
AlbumSelectTreeView(AlbumModel* const model, |
| 55 |
AlbumModificationHelper* const albumModificationHelper, |
| 56 |
QWidget* const parent = nullptr); |
| 57 |
|
| 58 |
/** |
| 59 |
* Destructor. |
| 60 |
*/ |
| 61 |
~AlbumSelectTreeView() override; |
| 62 |
|
| 63 |
void addCustomContextMenuActions(ContextMenuHelper& cmh, Album* album) override; |
| 64 |
void handleCustomContextMenuAction(QAction* action, const AlbumPointer<Album>& album) override; |
| 65 |
|
| 66 |
public Q_SLOTS: |
| 67 |
|
| 68 |
/** |
| 69 |
* Shows a dialog to create a new album under the selected album in this |
| 70 |
* view. |
| 71 |
*/ |
| 72 |
void slotNewAlbum(); |
| 73 |
|
| 74 |
private: |
| 75 |
|
| 76 |
class Private; |
| 77 |
Private* const d = nullptr; |
| 78 |
}; |
| 79 |
|
| 80 |
// ----------------------------------------------------------------------------------------------- |
| 81 |
|
| 82 |
class AlbumSelectWidget : public QWidget |
| 83 |
{ |
| 84 |
Q_OBJECT |
| 85 |
|
| 86 |
public: |
| 87 |
|
| 88 |
explicit AlbumSelectWidget(QWidget* const parent = nullptr, |
| 89 |
PAlbum* const albumToSelect = nullptr, |
| 90 |
bool completerSelect = false); |
| 91 |
~AlbumSelectWidget() override; |
| 92 |
|
| 93 |
void setCurrentAlbumUrl(const QUrl& albumUrl); |
| 94 |
QUrl currentAlbumUrl() const; |
| 95 |
|
| 96 |
PAlbum* currentAlbum() const; |
| 97 |
void setCurrentAlbum(PAlbum* const albumToSelect); |
| 98 |
|
| 99 |
Q_SIGNALS: |
| 100 |
|
| 101 |
void itemSelectionChanged(); |
| 102 |
void completerActivated(); |
| 103 |
|
| 104 |
private Q_SLOTS: |
| 105 |
|
| 106 |
void slotCompleterTimer(); |
| 107 |
void slotSelectionChanged(); |
| 108 |
void slotAlbumRenamed(Album*); |
| 109 |
void slotCompleterHighlighted(int albumId); |
| 110 |
|
| 111 |
private: |
| 112 |
|
| 113 |
class Private; |
| 114 |
Private* const d = nullptr; |
| 115 |
}; |
| 116 |
|
| 117 |
} // namespace Digikam |