File indexing completed on 2024-05-05 17:33:57

0001 /*
0002  *   SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
0003  *   SPDX-FileCopyrightText: 2008-2010 Matthias Fuchs <mat69@gmx.net>
0004  *   SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0005  *   SPDX-FileCopyrightText: 2022 Alexander Lohnau <alexander.lohnau@gmx.de>
0006  *
0007  *   SPDX-License-Identifier: GPL-2.0-or-later
0008  */
0009 
0010 #ifndef COMICMODEL_H
0011 #define COMICMODEL_H
0012 
0013 #include <QAbstractTableModel>
0014 
0015 #include "engine/comic.h"
0016 
0017 class ComicModel : public QAbstractTableModel
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     ComicModel(ComicEngine *engine, const QStringList &usedComics, QObject *parent = nullptr);
0023 
0024     QHash<int, QByteArray> roleNames() const override;
0025 
0026     int rowCount(const QModelIndex &index = QModelIndex()) const override;
0027     int columnCount(const QModelIndex &index = QModelIndex()) const override;
0028     QVariant data(const QModelIndex &index, int role = Qt::CheckStateRole) const override;
0029     Qt::ItemFlags flags(const QModelIndex &index) const override;
0030 
0031     void load();
0032 
0033 private:
0034     QList<ComicProviderInfo> mComics;
0035     QStringList mUsedComics;
0036     ComicEngine *mEngine;
0037 };
0038 
0039 #endif