File indexing completed on 2024-05-19 04:49:18

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Alexandre Pereira de Oliveira <aleprj@gmail.com>                  *
0003  * Copyright (c) 2007-2009 Maximilian Kossick <maximilian.kossick@googlemail.com>       *
0004  * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0005  * Copyright (c) 2011 Ralf Engels <ralf-engels@gmx.de>                                  *
0006  *                                                                                      *
0007  * This program is free software; you can redistribute it and/or modify it under        *
0008  * the terms of the GNU General Public License as published by the Free Software        *
0009  * Foundation; either version 2 of the License, or (at your option) any later           *
0010  * version.                                                                             *
0011  *                                                                                      *
0012  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0013  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0014  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0015  *                                                                                      *
0016  * You should have received a copy of the GNU General Public License along with         *
0017  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0018  ****************************************************************************************/
0019 
0020 #ifndef TEXTUALQUERYFILTER_H
0021 #define TEXTUALQUERYFILTER_H
0022 
0023 #include "amarok_export.h"
0024 
0025 #include "browsers/CollectionTreeItem.h"
0026 #include "core/meta/forward_declarations.h"
0027 #include "core/collections/QueryMaker.h"
0028 
0029 #include <QAbstractItemModel>
0030 #include <QDateTime>
0031 
0032 namespace Collections
0033 {
0034     /** Adds a conditions to the query maker specified in the filter.
0035         This is the engine behind the search field.
0036     */
0037     void addTextualFilter( Collections::QueryMaker *qm, const QString &filter );
0038 
0039     void addDateFilter( qint64 field, Collections::QueryMaker::NumberComparison compare,
0040                         bool negate, const QString &text, Collections::QueryMaker *qm );
0041 
0042     /** Returns a QDateTime from a text.
0043         e.g. converts "today" to the current date.
0044 
0045     */
0046     QDateTime semanticDateTimeParser( const QString &text, bool *absolute = nullptr );
0047 
0048 }
0049 
0050 #endif