File indexing completed on 2025-01-19 03:53:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-26-02 0007 * Description : a widget to select a physical album 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2010 by Johannes Wienke <languitar at semipol dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_ALBUM_SELECT_WIDGET_H 0017 #define DIGIKAM_ALBUM_SELECT_WIDGET_H 0018 0019 // Qt includes 0020 0021 #include <QWidget> 0022 0023 // Local includes 0024 0025 #include "albummanager.h" 0026 #include "albumtreeview.h" 0027 #include "searchtextbardb.h" 0028 0029 class QTreeWidget; 0030 0031 namespace Digikam 0032 { 0033 0034 class PAlbum; 0035 class AlbumModificationHelper; 0036 0037 /** 0038 * Enables a simple context menu only for creating a new album. 0039 * 0040 * @author jwienke 0041 */ 0042 class AlbumSelectTreeView: public AlbumTreeView 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 0048 /** 0049 * Constructor. 0050 * 0051 * @param model album model to work with 0052 * @param albumModificationHelper helper object for modifying albums 0053 * @param parent the parent for Qt's parent child mechanism 0054 */ 0055 AlbumSelectTreeView(AlbumModel* const model, 0056 AlbumModificationHelper* const albumModificationHelper, 0057 QWidget* const parent = nullptr); 0058 0059 /** 0060 * Destructor. 0061 */ 0062 ~AlbumSelectTreeView() override; 0063 0064 void addCustomContextMenuActions(ContextMenuHelper& cmh, Album* album) override; 0065 void handleCustomContextMenuAction(QAction* action, const AlbumPointer<Album>& album) override; 0066 0067 public Q_SLOTS: 0068 0069 /** 0070 * Shows a dialog to create a new album under the selected album in this 0071 * view. 0072 */ 0073 void slotNewAlbum(); 0074 0075 private: 0076 0077 class Private; 0078 Private* d; 0079 }; 0080 0081 // ----------------------------------------------------------------------------------------------- 0082 0083 class AlbumSelectWidget : public QWidget 0084 { 0085 Q_OBJECT 0086 0087 public: 0088 0089 explicit AlbumSelectWidget(QWidget* const parent = nullptr, 0090 PAlbum* const albumToSelect = nullptr, 0091 bool completerSelect = false); 0092 ~AlbumSelectWidget() override; 0093 0094 void setCurrentAlbumUrl(const QUrl& albumUrl); 0095 QUrl currentAlbumUrl() const; 0096 0097 PAlbum* currentAlbum() const; 0098 void setCurrentAlbum(PAlbum* const albumToSelect); 0099 0100 Q_SIGNALS: 0101 0102 void itemSelectionChanged(); 0103 void completerActivated(); 0104 0105 private Q_SLOTS: 0106 0107 void slotCompleterTimer(); 0108 void slotSelectionChanged(); 0109 void slotAlbumRenamed(Album*); 0110 void slotCompleterHighlighted(int albumId); 0111 0112 private: 0113 0114 class Private; 0115 Private* const d; 0116 }; 0117 0118 } // namespace Digikam 0119 0120 #endif // DIGIKAM_ALBUM_SELECT_WIDGET_H