1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwSongdbFilterNode_h_
21 #define _KwSongdbFilterNode_h_
24 * @file KwSongdbFilterNode.h
25 * @brief A node for filtering songs.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwSongdbNode.h"
30 #include "KwSongdbFilter.h"
36 /// A node for filtering songs.
37 class KwSongdbFilterNode
: public KwSongdbNode
42 * Constructors + destructor
45 /// Primary constructor.
46 KwSongdbFilterNode(const KwSongdbFilterLevelList
* filters
, QString label
, KwSongdbNode
* parent
);
49 virtual ~KwSongdbFilterNode();
52 * Associated data access
55 virtual KwSongdbSong
* associatedSong();
56 virtual KwSongdbVersion
* associatedSongVersion();
62 /// Get data associated with the node.
63 virtual QVariant
getData(int role
, int column
);
65 /// Get the number of children.
66 virtual int getChildCount() const;
68 /// Get flags for this item.
69 virtual Qt::ItemFlags
getFlags(Qt::ItemFlags defaultFlags
) const;
71 /// Get mime data string for this set of songs.
72 virtual QString
mimeData();
76 /// Get a child node by index.
77 virtual KwSongdbNode
* _getChild(int index
);
79 /// Get a new node of this type.
80 KwSongdbFilterNode
* _newNode(QString label
, QString idExpression
, int idValue
);
82 /// Get a new final node.
83 KwSongdbNode
* _newFinalNode(QString label
, int id
, const QIcon
& icon
);
91 /// A known value from a previous filter.
106 /// The shared list of filters.
107 const KwSongdbFilterLevelList
* m_filterLevels
;
109 /// The current filter level we're on.
112 /// The list of known values.
113 KnownValue m_knownValue
;
115 /// Current SQL query.
119 * Private constructors
122 /// Primary constructor.
123 KwSongdbFilterNode(KwSongdbFilterNode
* parent
, QString label
, QString knownIdExpression
, int knownId
);
133 #endif // _KwSongdbFilterNode_h_