File indexing completed on 2024-05-05 04:51:38
0001 /* 0002 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 0003 SPDX-FileCopyrightText: 1998-2010 Sebastian Trueg <trueg@k3b.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef K3B_THEMEMODEL_H 0009 #define K3B_THEMEMODEL_H 0010 0011 #include <QAbstractItemModel> 0012 0013 0014 namespace K3b { 0015 0016 class DataDoc; 0017 class Theme; 0018 class ThemeManager; 0019 0020 class ThemeModel : public QAbstractTableModel 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 enum Columns { 0026 ThemeColumn, 0027 AuthorColumn, 0028 VersionColumn, 0029 CommentColumn, 0030 NumColumns 0031 }; 0032 0033 public: 0034 explicit ThemeModel( ThemeManager* themeManager, QObject* parent = 0 ); 0035 ~ThemeModel() override; 0036 0037 /** 0038 * Re-reads themes on disk and updates the model 0039 */ 0040 void reload(); 0041 0042 Theme* themeForIndex( const QModelIndex& index ) const; 0043 QModelIndex indexForTheme( Theme* theme, int column = ThemeColumn ) const; 0044 0045 QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; 0046 int columnCount( const QModelIndex& parent = QModelIndex() ) const override; 0047 int rowCount( const QModelIndex& parent = QModelIndex() ) const override; 0048 QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override; 0049 bool removeRows( int row, int count, const QModelIndex& parent = QModelIndex() ) override; 0050 0051 private: 0052 ThemeManager* m_themeManager; 0053 }; 0054 0055 } 0056 0057 #endif // K3B_THEMEMODEL_H