1 /*
2     SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl>
3     SPDX-FileCopyrightText: 1998-2010 Sebastian Trueg <trueg@k3b.org>
4 
5     SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #ifndef K3B_THEMEMODEL_H
9 #define K3B_THEMEMODEL_H
10 
11 #include <QAbstractItemModel>
12 
13 
14 namespace K3b {
15 
16     class DataDoc;
17     class Theme;
18     class ThemeManager;
19 
20     class ThemeModel : public QAbstractTableModel
21     {
22         Q_OBJECT
23 
24     public:
25         enum Columns {
26             ThemeColumn,
27             AuthorColumn,
28             VersionColumn,
29             CommentColumn,
30             NumColumns
31         };
32 
33     public:
34         explicit ThemeModel( ThemeManager* themeManager, QObject* parent = 0 );
35         ~ThemeModel() override;
36 
37         /**
38          * Re-reads themes on disk and updates the model
39          */
40         void reload();
41 
42         Theme* themeForIndex( const QModelIndex& index ) const;
43         QModelIndex indexForTheme( Theme* theme, int column = ThemeColumn ) const;
44 
45         QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
46         int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
47         int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
48         QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
49         bool removeRows( int row, int count, const QModelIndex& parent = QModelIndex() ) override;
50 
51     private:
52         ThemeManager* m_themeManager;
53     };
54 
55 }
56 
57 #endif // K3B_THEMEMODEL_H
58