/* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2014-05-17 * Description : Album Labels Search Tree View. * * SPDX-FileCopyrightText: 2014-2015 by Mohamed_Anwer * SPDX-FileCopyrightText: 2014-2026 by Gilles Caulier * * SPDX-License-Identifier: GPL-2.0-or-later * * ============================================================ */ #pragma once #include "labelstreeview.h" namespace Digikam { class AlbumLabelsSearchHandler : public QObject { Q_OBJECT public: explicit AlbumLabelsSearchHandler(LabelsTreeView* const treeWidget); ~AlbumLabelsSearchHandler() override; /** * @return Album pointer of the currently selected labels */ Album* albumForSelectedItems() const; /** * @brief Gets the list of images generated, for exporting * * @return QUrl List of images Urls */ QList imagesUrls() const; /** * @return A string for a name generated by @see * generateAlbumNameForExporting() */ QString generatedName() const; /** * @brief Restores the selection of the tree-view from history * * @param neededLabels a hash to restore selection from it */ void restoreSelectionFromHistory(const QHash >& neededLabels); /** * @return true if the tree-view is restoring the selection state * from history to block searching until the restoring * is done */ bool isRestoringSelectionFromHistory() const; private: /** * @brief Create XML for currently selected labels * * @param selectedLabels to generate XML for it * @return XML generated */ QString createXMLForCurrentSelection(const QHash >& selectedLabels); /** * @brief Passes the generated XML to CoreDB class * search methods * * @param xml generated from @see createXMLForCurrentSelection * @return A pointer of the search album created by the CoreDB */ SAlbum* search(const QString& xml) const; /** * @brief Generates album name based on the selected labels for * example if rating 2 and 5 are selected then the name is * "Rating: 2, 5", If there are any selected picks for example * Pending, then the generated name is "Rating: 2, 5 | Picks: Pending" */ void generateAlbumNameForExporting(const QList& ratings, const QList& colorsList, const QList& picksList); /** * @brief Passes the current album DB url to a DBJobsManager * to get images urls in this album */ void imagesUrlsForCurrentAlbum(); /** * @return "Labels Album" if the tree-widget is not checkable * and returns "Exporting Album" if it was checkable */ QString getDefaultTitle() const; private Q_SLOTS: void slotSelectionChanged(); void slotCheckStateChanged(); void slotSetCurrentAlbum(); void slotResult(); void slotData(const QList& data); Q_SIGNALS: void checkStateChanged(Album* album, Qt::CheckState checkState); private: class Private; Private* const d = nullptr; }; } // namespace Digikam