File indexing completed on 2024-05-05 04:51:43

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_K3BBOOTIMAGEMODEL_H
0009 #define K3B_K3BBOOTIMAGEMODEL_H
0010 
0011 #include "k3bbootitem.h"
0012 #include <QAbstractItemModel>
0013 
0014 
0015 namespace K3b {
0016     
0017     class DataDoc;
0018 
0019     class BootImageModel : public QAbstractTableModel
0020     {
0021         Q_OBJECT
0022         
0023     public:
0024         enum Columns {
0025             EmulationTypeColumn,
0026             SizeColumn,
0027             LocalPathColumn,
0028             NumColumns
0029         };
0030         
0031     public:
0032         explicit BootImageModel( DataDoc* doc, QObject* parent = 0 );
0033         ~BootImageModel() override;
0034         
0035         BootItem* bootItemForIndex( const QModelIndex& index ) const;
0036         QModelIndex indexForBootItem( BootItem* bootItem, int column = EmulationTypeColumn ) const;
0037         
0038         void createBootItem( const QString& file, BootItem::ImageType imageType );
0039         void setImageType( const QModelIndex& index, BootItem::ImageType imageType );
0040         
0041         QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
0042         int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
0043         int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
0044         QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
0045         bool removeRows( int row, int count, const QModelIndex& parent = QModelIndex() ) override;
0046         
0047     private:
0048         DataDoc* m_doc;
0049     };
0050 
0051 }
0052 
0053 #endif // K3B_K3BBOOTIMAGEMODEL_H