File indexing completed on 2025-01-19 03:59:39

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-02-26
0007  * Description : Upper widget in the search sidebar
0008  *
0009  * SPDX-FileCopyrightText: 2008-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_SEARCH_TAB_HEADER_H
0016 #define DIGIKAM_SEARCH_TAB_HEADER_H
0017 
0018 // Qt includes
0019 
0020 #include <QWidget>
0021 
0022 // Local includes
0023 
0024 #include "coredbalbuminfo.h"
0025 
0026 namespace Digikam
0027 {
0028 
0029 class Album;
0030 class SAlbum;
0031 class SearchWindow;
0032 
0033 class SearchTabHeader : public QWidget
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038 
0039     explicit SearchTabHeader(QWidget* const parent);
0040     ~SearchTabHeader() override;
0041 
0042 public Q_SLOTS:
0043 
0044     void selectedSearchChanged(Album* album);
0045     void editSearch(SAlbum* album);
0046     void newKeywordSearch();
0047     void newAdvancedSearch();
0048 
0049 Q_SIGNALS:
0050 
0051     void searchShallBeSelected(const QList<Album*>& albums);
0052 
0053 private Q_SLOTS:
0054 
0055     void keywordChanged();
0056     void keywordChangedTimer();
0057     void slotEditCurrentSearch();
0058     void saveSearch();
0059     void storedKeywordChanged();
0060     void editStoredAdvancedSearch();
0061     void advancedSearchEdited(int id, const QString& query);
0062 
0063 private:
0064 
0065     void          setCurrentSearch(DatabaseSearch::Type type, const QString& query, bool selectCurrentAlbum = true);
0066     QString       queryFromKeywords(const QString& keywords) const;
0067     QString       keywordsFromQuery(const QString& query) const;
0068     SearchWindow* searchWindow() const;
0069 
0070 private:
0071 
0072     class Private;
0073     Private* const d;
0074 };
0075 
0076 } // namespace Digikam
0077 
0078 #endif // DIGIKAM_SEARCH_TAB_HEADER_H