File indexing completed on 2024-05-12 08:34:16
0001 /* SPDX-FileCopyrightText: 2022 Noah Davis <noahadvs@gmail.com> 0002 * SPDX-License-Identifier: LGPL-2.0-or-later 0003 */ 0004 0005 #pragma once 0006 0007 #include "Platforms/VideoPlatform.h" 0008 0009 #include <QAbstractListModel> 0010 0011 /** 0012 * This is a model containing the current supported capture modes and their labels and shortcuts. 0013 */ 0014 class VideoFormatModel : public QAbstractListModel 0015 { 0016 Q_OBJECT 0017 Q_PROPERTY(int count READ rowCount CONSTANT FINAL) 0018 public: 0019 VideoFormatModel(VideoPlatform::Formats formats, QObject *parent = nullptr); 0020 0021 enum { 0022 FormatRole = Qt::UserRole + 1, 0023 ExtensionRole = Qt::UserRole + 2, 0024 }; 0025 0026 int indexOfFormat(VideoPlatform::Format format) const; 0027 0028 QHash<int, QByteArray> roleNames() const override; 0029 QVariant data(const QModelIndex &index, int role) const override; 0030 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0031 0032 Q_SIGNALS: 0033 void countChanged(); 0034 0035 private: 0036 struct Item { 0037 QString label; 0038 VideoPlatform::Format format = VideoPlatform::NoFormat; 0039 QString extension = {}; 0040 }; 0041 0042 QList<Item> m_data; 0043 QHash<int, QByteArray> m_roleNames; 0044 };