blob: 99d5898e1b6dd10899bf6054d15e28dcc8543055 [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
2 * Copyright (C) 2019-2020 by Savoir-faire Linux
3 * Author: Yang Wang <yang.wang@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <QAbstractItemModel>
22
23#include "api/account.h"
24#include "api/contact.h"
25#include "api/conversation.h"
26#include "api/newdevicemodel.h"
27
28#include "lrcinstance.h"
29
30class VideoInputDeviceModel : public QAbstractListModel
31{
32 Q_OBJECT
33public:
34 enum Role {
35 DeviceChannel = Qt::UserRole + 1,
36 DeviceName,
37 DeviceId,
38 CurrentFrameRate,
39 CurrentResolution,
40 DeviceName_UTF8
41 };
42 Q_ENUM(Role)
43
44 explicit VideoInputDeviceModel(QObject *parent = 0);
45 ~VideoInputDeviceModel();
46
47 /*
48 * QAbstractListModel override.
49 */
50 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
51 int columnCount(const QModelIndex &parent) const override;
52 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
53 /*
54 * Override role name as access point in qml.
55 */
56 QHash<int, QByteArray> roleNames() const override;
57 QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
58 QModelIndex parent(const QModelIndex &child) const;
59 Qt::ItemFlags flags(const QModelIndex &index) const;
60
61 /*
62 * This function is to reset the model when there's new account added.
63 */
64 Q_INVOKABLE void reset();
65 /*
66 * This function is to reset the model when there's new account added.
67 */
68 Q_INVOKABLE int deviceCount();
69 /*
70 * This function is to get the current device id in the demon.
71 */
72 Q_INVOKABLE int getCurrentSettingIndex();
73};