File indexing completed on 2024-05-19 04:50:24

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef DYNAMICSCRIPTABLESERVICECOLLECTION_H
0018 #define DYNAMICSCRIPTABLESERVICECOLLECTION_H
0019 
0020 #include "../ServiceCollection.h"
0021 #include "AmarokProcess.h"
0022 
0023 namespace Collections {
0024 
0025 /**
0026 A collection that can call back a script to populate items as needed.
0027 
0028     @author 
0029 */
0030 class ScriptableServiceCollection : public ServiceCollection
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit ScriptableServiceCollection( const QString &name );
0035 
0036     ~ScriptableServiceCollection() override;
0037 
0038     Collections::QueryMaker* queryMaker() override;
0039 
0040     void donePopulating( int parentId );
0041 
0042     void setLevels( int theValue ) {
0043         m_levels = theValue;
0044     }
0045     
0046     int levels() const {
0047         return m_levels;
0048     }
0049 
0050     void setLastFilter( const QString & filter ) { m_lastFilter = filter; }
0051     QString lastFilter() { return m_lastFilter; }
0052 
0053     void clear();
0054 
0055     Q_SIGNALS:
0056         void updateComplete();
0057 
0058 private:
0059 
0060     QString m_name;
0061     int m_levels;
0062     QString m_lastFilter;
0063 
0064 };
0065 
0066 } //namespace Collections
0067 
0068 #endif