blob: 03836bed23c449b22ff6c4d20755236916d5013a [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 AudioInputDeviceModel : public QAbstractListModel
31{
32 Q_OBJECT
33public:
34 enum Role { Device_ID = Qt::UserRole + 1, ID_UTF8 };
35 Q_ENUM(Role)
36
37 explicit AudioInputDeviceModel(QObject *parent = 0);
38 ~AudioInputDeviceModel();
39
40 /*
41 * QAbstractListModel override.
42 */
43 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
44 int columnCount(const QModelIndex &parent) const override;
45 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
46 /*
47 * Override role name as access point in qml.
48 */
49 QHash<int, QByteArray> roleNames() const override;
50 QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
51 QModelIndex parent(const QModelIndex &child) const;
52 Qt::ItemFlags flags(const QModelIndex &index) const;
53
54 /*
55 * This function is to reset the model when there's new account added.
56 */
57 Q_INVOKABLE void reset();
58 /*
59 * This function is to get the current device id in the demon.
60 */
61 Q_INVOKABLE int getCurrentSettingIndex();
62};