summaryrefslogtreecommitdiff
path: root/qicclient/catalog.hxx
blob: 244f4f076261b9d0d002e506937fb7d0122b9ba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef QICCLIENT_CATALOG_HXX
#define QICCLIENT_CATALOG_HXX

#include <QAbstractListModel>
#include "product.hxx"

struct icclient_catalog;

namespace QICClient {

	class Catalog : public QAbstractListModel
	{
		Q_OBJECT

		public:
			Catalog(icclient_catalog* catalog, QObject* parent = nullptr);
			~Catalog();
			int rowCount(QModelIndex const& parent = QModelIndex()) const Q_DECL_OVERRIDE;
			QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
			icclient_catalog const* constData() const { return m_data; }

		protected:
			QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;

		private:
			void addProduct(Product const& product);
			QList<Product> products;
			icclient_catalog* m_data;
	};

}

#endif