2
* Copyright (C) 2015 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef UNITY_MOCK_SESSIONSMODEL_H
19
#define UNITY_MOCK_SESSIONSMODEL_H
21
#include <QtCore/QAbstractListModel>
22
#include <QtCore/QString>
26
class SessionsModelPrivate;
28
class Q_DECL_EXPORT SessionsModel : public QAbstractListModel
32
Q_ENUMS(SessionModelRoles SessionType)
36
enum SessionModelRoles {
37
//name is exposed as Qt::DisplayRole
38
//comment is exposed as Qt::TooltipRole
39
KeyRole = Qt::UserRole,
40
IdRole = KeyRole, /** Deprecated */
49
explicit SessionsModel(QObject* parent=nullptr); /** Deprecated. Loads local sessions*/
50
explicit SessionsModel(SessionsModel::SessionType, QObject* parent=nullptr);
51
virtual ~SessionsModel();
53
QHash<int, QByteArray> roleNames() const override;
54
int rowCount(const QModelIndex& parent) const override;
55
QVariant data(const QModelIndex& index, int role) const override;
57
int numSessions() const;
58
int numAvailableSessions() const;
59
QString testScenario() const;
60
void setNumSessions(int numSessions);
61
void setTestScenario(QString testScenario);
64
SessionsModelPrivate* const d_ptr;
67
QHash<int, QByteArray> m_roleNames;
68
Q_DECLARE_PRIVATE(SessionsModel)
72
#endif // UNITY_MOCK_SESSIONSMODEL_H