File indexing completed on 2024-05-05 04:34:54
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 class RecordingModeModel : public QAbstractListModel 0012 { 0013 Q_OBJECT 0014 Q_PROPERTY(int count READ rowCount NOTIFY countChanged FINAL) 0015 public: 0016 RecordingModeModel(VideoPlatform::RecordingModes modes, QObject *parent = nullptr); 0017 0018 enum { 0019 RecordingModeRole = Qt::UserRole + 1, 0020 }; 0021 0022 QHash<int, QByteArray> roleNames() const override; 0023 QVariant data(const QModelIndex &index, int role) const override; 0024 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0025 0026 int indexOfRecordingMode(VideoPlatform::RecordingMode mode) const; 0027 0028 Q_SIGNALS: 0029 void countChanged(); 0030 0031 private: 0032 struct Item { 0033 VideoPlatform::RecordingMode mode; 0034 QString label; 0035 }; 0036 0037 QList<Item> m_data; 0038 QHash<int, QByteArray> m_roleNames; 0039 const VideoPlatform::RecordingModes m_modes; 0040 };