1
/****************************************************************************
2
* Copyright (C) 2012-2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
* This library is free software; you can redistribute it and/or *
6
* modify it under the terms of the GNU Lesser General Public *
7
* License as published by the Free Software Foundation; either *
8
* version 2.1 of the License, or (at your option) any later version. *
10
* This library 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 GNU *
13
* Lesser General Public License for more details. *
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
#ifndef USERACTIONMODEL_H
19
#define USERACTIONMODEL_H
21
#include <QtCore/QString>
22
#include <QtCore/QAbstractItemModel>
30
* @class UserActionModel Hold available actions for a given call state
32
class LIB_EXPORT UserActionModel : public QObject/*QAbstractItemModel*/ {
33
#pragma GCC diagnostic push
34
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
36
#pragma GCC diagnostic pop
45
///(End)user action, all possibility, not only state aware ones like "Action"
61
Q_PROPERTY( bool isPickupEnabled READ isPickupEnabled NOTIFY actionStateChanged )
62
Q_PROPERTY( bool isHoldEnabled READ isHoldEnabled NOTIFY actionStateChanged )
63
Q_PROPERTY( bool isUnholdEnabled READ isUnholdEnabled NOTIFY actionStateChanged )
64
Q_PROPERTY( bool isHangupEnabled READ isHangupEnabled NOTIFY actionStateChanged )
65
Q_PROPERTY( bool isMuteEnabled READ isMuteEnabled NOTIFY actionStateChanged )
66
Q_PROPERTY( bool isTransferEnabled READ isTransferEnabled NOTIFY actionStateChanged )
67
Q_PROPERTY( bool isRecordEnabled READ isRecordEnabled NOTIFY actionStateChanged )
68
Q_PROPERTY( bool isRefuseEnabled READ isRefuseEnabled NOTIFY actionStateChanged )
69
Q_PROPERTY( bool isAcceptEnabled READ isAcceptEnabled NOTIFY actionStateChanged )
70
Q_PROPERTY( uint enabledCount READ enabledCount NOTIFY actionStateChanged )
73
explicit UserActionModel(Call* parent);
75
//Abstract model members
76
// virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole ) const;
77
// virtual int rowCount (const QModelIndex& parent = QModelIndex() ) const;
78
// virtual int columnCount(const QModelIndex& parent = QModelIndex() ) const;
79
// virtual Qt::ItemFlags flags (const QModelIndex& index ) const;
80
// virtual bool setData (const QModelIndex& index, const QVariant &value, int role);
83
Q_INVOKABLE bool isActionEnabled ( UserActionModel::Action action ) const;
84
Q_INVOKABLE uint relativeIndex ( UserActionModel::Action action ) const;
85
Q_INVOKABLE uint enabledCount ( ) const;
87
bool isPickupEnabled () const;
88
bool isHoldEnabled () const;
89
bool isUnholdEnabled () const;
90
bool isHangupEnabled () const;
91
bool isMuteEnabled () const;
92
bool isTransferEnabled() const;
93
bool isRecordEnabled () const;
94
bool isRefuseEnabled () const;
95
bool isAcceptEnabled () const;
98
static const TypedStateMachine< TypedStateMachine< bool , Call::State > , UserActionModel::Action > availableActionMap;
104
void slotStateChanged();
107
void actionStateChanged();
109
// Q_DECLARE_METATYPE(UserActionModel*)