File indexing completed on 2024-05-19 04:50:13
0001 /**************************************************************************************** 0002 * Copyright (c) 2011 Stefan Derkits <stefan@derkits.at> * 0003 * Copyright (c) 2011 Christian Wagner <christian.wagner86@gmx.at> * 0004 * Copyright (c) 2011 Felix Winter <ixos01@gmail.com> * 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 GPODDERTREEITEM_H_ 0020 #define GPODDERTREEITEM_H_ 0021 0022 #include <mygpo-qt5/ApiRequest.h> 0023 #include <mygpo-qt5/TagList.h> 0024 0025 #include <QList> 0026 #include <QModelIndex> 0027 #include <QVariant> 0028 0029 0030 class GpodderTreeItem : public QObject 0031 { 0032 Q_OBJECT 0033 public: 0034 explicit GpodderTreeItem( GpodderTreeItem *parent = nullptr, const QString &name = QString() ); 0035 ~GpodderTreeItem() override; 0036 0037 void appendChild( GpodderTreeItem *child ); 0038 0039 GpodderTreeItem *child( int row ); 0040 int childCount() const; 0041 void setHasChildren( bool hasChildren ); 0042 bool hasChildren() const; 0043 0044 GpodderTreeItem *parent() const; 0045 bool isRoot() const; 0046 0047 0048 virtual QVariant displayData() const; 0049 0050 virtual void appendTags( mygpo::TagListPtr tags ); 0051 virtual void appendPodcasts( mygpo::PodcastListPtr podcasts ); 0052 private: 0053 QList<GpodderTreeItem *> m_childItems; 0054 GpodderTreeItem *m_parentItem; 0055 QString m_name; 0056 bool m_hasChildren; 0057 }; 0058 0059 #endif /* GPODDERTREEITEM_H_ */