File indexing completed on 2024-05-05 04:47:30

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Alexandre Pereira de Oliveira <aleprj@gmail.com>                  *
0003  * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
0004  * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0005  *                                                                                      *
0006  * This program is free software; you can redistribute it and/or modify it under        *
0007  * the terms of the GNU General Public License as published by the Free Software        *
0008  * Foundation; either version 2 of the License, or (at your option) any later           *
0009  * version.                                                                             *
0010  *                                                                                      *
0011  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0013  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0014  *                                                                                      *
0015  * You should have received a copy of the GNU General Public License along with         *
0016  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0017  ****************************************************************************************/
0018 
0019 #ifndef SINGLECOLLECTIONTREEITEMMODEL_H
0020 #define SINGLECOLLECTIONTREEITEMMODEL_H
0021 
0022 #include "amarok_export.h"
0023 #include "CollectionTreeItemModelBase.h"
0024 #include "core/meta/forward_declarations.h"
0025 
0026 #include <QAbstractItemModel>
0027 #include <QMap>
0028 #include <QPair>
0029 
0030 class CollectionTreeItem;
0031 class Collection;
0032 //typedef QPair<Collection*, CollectionTreeItem* > CollectionRoot;
0033 
0034 
0035 class AMAROK_EXPORT SingleCollectionTreeItemModel: public CollectionTreeItemModelBase 
0036 {
0037     Q_OBJECT
0038 
0039     public:
0040         SingleCollectionTreeItemModel( Collections::Collection *collection,
0041                                        const QList<CategoryId::CatMenuId> &levelType );
0042 
0043         QVariant data(const QModelIndex &index, int role) const override;
0044         bool canFetchMore( const QModelIndex &parent ) const override;
0045         void fetchMore( const QModelIndex &parent ) override;
0046         Qt::ItemFlags flags(const QModelIndex &index) const override;
0047 
0048     protected:
0049         void filterChildren() override;
0050         int levelModifier() const override { return 1; }
0051 
0052     private:
0053 
0054         Collections::Collection* m_collection;
0055 };
0056 
0057 #endif