GCC Code Coverage Report


Directory: ./
File: qtpdcom/QtPdCom1/BroadcastModel.h
Date: 2023-11-12 04:06:57
Exec Total Coverage
Lines: 0 3 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright (C) 2009-2023 Bjarne von Horn <vh@igh.de>
4 *
5 * This file is part of the QtPdCom library.
6 *
7 * The QtPdCom library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The QtPdCom library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ****************************************************************************/
21
22 #ifndef BROADCASTMODEL_H
23 #define BROADCASTMODEL_H
24
25 #include <QAbstractTableModel>
26 #include <QList>
27 #include <QString>
28
29 #include "Export.h"
30 #include "Process.h"
31
32 namespace QtPdCom {
33 class Process;
34
35 class BroadcastModelPrivate;
36
37 /**
38 * \brief Model for capturing broadcast messages.
39 *
40 * It contains three columns (date, message, username).
41 * Please note that broadcasts have to be enabled in pdserv.
42 */
43 class QTPDCOM_PUBLIC BroadcastModel: public QAbstractTableModel
44 {
45 Q_OBJECT
46 Q_PROPERTY(QtPdCom::Process *process READ getProcess WRITE connectProcess)
47
48 public:
49 explicit BroadcastModel(QObject *parent = nullptr);
50 ~BroadcastModel();
51
52 int rowCount(const QModelIndex & = {}) const override;
53 int columnCount(const QModelIndex & = {}) const override;
54 QVariant
55 data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
56 QVariant headerData(
57 int section,
58 Qt::Orientation orientation,
59 int role = Qt::DisplayRole) const override;
60
61 /** Connect to a Process.
62 *
63 * The old Process will be disconnected.
64 * \param process New Process.
65 */
66 void connectProcess(QtPdCom::Process *process);
67 QtPdCom::Process *getProcess() const;
68 /**
69 * Clear all stored broadcasts.
70 */
71 Q_INVOKABLE void clear();
72
73 enum Roles {
74 DateStringRole = Qt::UserRole + 1,
75 MessageStringRole,
76 UsernameRole,
77 };
78 Q_ENUM(Roles);
79 QHash<int, QByteArray> roleNames() const override;
80
81 private:
82 Q_DECLARE_PRIVATE(BroadcastModel);
83
84 QScopedPointer<BroadcastModelPrivate> const d_ptr;
85 };
86
87 } // namespace QtPdCom
88
89
90 #endif // BROADCASTMODEL_H
91