File indexing completed on 2024-05-12 04:51:53

0001 /*
0002     SPDX-FileCopyrightText: 2009 Michal Malek <michalm@jabster.pl>
0003     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef _K3B_VIDEODVDTITLEMODEL_H_
0009 #define _K3B_VIDEODVDTITLEMODEL_H_
0010 
0011 #include <QAbstractTableModel>
0012 
0013 
0014 namespace K3b {
0015 
0016 namespace VideoDVD { class VideoDVD; }
0017 
0018 class VideoDVDTitleModel : public QAbstractTableModel
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit VideoDVDTitleModel( QObject* parent = 0 );
0024     ~VideoDVDTitleModel() override;
0025 
0026     enum Columns {
0027         TitleColumn = 0,
0028         PreviewColumn,
0029         VideoColumn,
0030         AudioColumn,
0031         SubpictureColumn,
0032         NumColumns
0033     };
0034 
0035     enum Roles {
0036         ChaptersRole = Qt::UserRole,    // returns QString
0037         PreviewRole,                    // returns QPixmap
0038         AspectRatioRole,                // returns QString
0039         AudioStreamsRole,               // returns QStringList
0040         SubpictureStreamsRole,          // returns QStringList
0041         LengthRole
0042     };
0043 
0044     void setVideoDVD( const VideoDVD::VideoDVD& dvd );
0045     QList<int> selectedTitles() const;
0046 
0047     Qt::ItemFlags flags( const QModelIndex& index ) const override;
0048     QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
0049     bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override;
0050     QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
0051     int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
0052     int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
0053     QModelIndex buddy( const QModelIndex& index ) const override;
0054 
0055 public Q_SLOTS:
0056     void checkAll();
0057     void uncheckAll();
0058     void stopPreviewGen();
0059 
0060 private Q_SLOTS:
0061     void slotPreviewDone( bool success );
0062 
0063 private:
0064     class Private;
0065     Private* d;
0066 };
0067 
0068 } // namespace K3b
0069 
0070 #endif // _K3B_VIDEODVDTITLEMODEL_H_