File indexing completed on 2025-01-05 04:00:07

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-01-20
0007  * Description : User interface for searches
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_WINDOW_H
0016 #define DIGIKAM_SEARCH_WINDOW_H
0017 
0018 // Qt includes
0019 
0020 #include <QWidget>
0021 
0022 namespace Digikam
0023 {
0024 
0025 class SearchWindow : public QWidget
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030 
0031     /**
0032      * Create a new SearchWindow with an empty advanced search
0033      */
0034     SearchWindow();
0035 
0036     ~SearchWindow() override;
0037 
0038     /**
0039      * Read the given search into the search widgets.
0040      * The id will be emitted with the searchEdited signal.
0041      */
0042     void readSearch(int id, const QString& query);
0043 
0044     /**
0045      * Reset the search widget to an empty search.
0046      * Current id is -1.
0047      */
0048     void reset();
0049 
0050     /**
0051      * Returns the currently produced search string
0052      */
0053     QString search() const;
0054 
0055 Q_SIGNALS:
0056 
0057     /**
0058      * Signals that the user has finished editing the search.
0059      * The given query is the same as search().
0060      */
0061     void searchEdited(int id, const QString& query);
0062 
0063 protected Q_SLOTS:
0064 
0065     void searchOk();
0066     void searchCancel();
0067     void searchTryout();
0068 
0069 protected:
0070 
0071     void keyPressEvent(QKeyEvent*) override;
0072 
0073 private:
0074 
0075     // Disable
0076     SearchWindow(QWidget*) = delete;
0077 
0078 private:
0079 
0080     class Private;
0081     Private* const d;
0082 };
0083 
0084 } // namespace Digikam
0085 
0086 #endif // DIGIKAM_SEARCH_WINDOW_H