~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to kde/src/lib/useractionmodel.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
 *   Copyright (C) 2012-2014 by Savoir-Faire Linux                          *
 
3
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
 
4
 *                                                                          *
 
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.     *
 
9
 *                                                                          *
 
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.                        *
 
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
#ifndef USERACTIONMODEL_H
 
19
#define USERACTIONMODEL_H
 
20
 
 
21
#include <QtCore/QString>
 
22
#include <QtCore/QAbstractItemModel>
 
23
#include "typedefs.h"
 
24
 
 
25
#include "call.h"
 
26
 
 
27
class Call;
 
28
 
 
29
/**
 
30
 * @class UserActionModel Hold available actions for a given call state
 
31
 **/
 
32
class LIB_EXPORT UserActionModel : public QObject/*QAbstractItemModel*/ {
 
33
   #pragma GCC diagnostic push
 
34
   #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
 
35
   Q_OBJECT
 
36
   #pragma GCC diagnostic pop
 
37
public:
 
38
 
 
39
   //Roles
 
40
   enum Role {
 
41
      VISIBLE       = 100,
 
42
      RELATIVEINDEX = 101,
 
43
   };
 
44
 
 
45
   ///(End)user action, all possibility, not only state aware ones like "Action"
 
46
   enum class Action {
 
47
      PICKUP   = 0,
 
48
      HOLD     = 1,
 
49
      UNHOLD   = 2,
 
50
      MUTE     = 3,
 
51
      TRANSFER = 4,
 
52
      RECORD   = 5,
 
53
      REFUSE   = 6,
 
54
      ACCEPT   = 7,
 
55
      HANGUP   = 8,
 
56
      COUNT,
 
57
   };
 
58
   Q_ENUMS(Action)
 
59
 
 
60
   //Properties
 
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 )
 
71
 
 
72
   //Constructor
 
73
   explicit UserActionModel(Call* parent);
 
74
 
 
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);
 
81
 
 
82
   //Getters
 
83
   Q_INVOKABLE bool isActionEnabled ( UserActionModel::Action action ) const;
 
84
   Q_INVOKABLE uint relativeIndex   ( UserActionModel::Action action ) const;
 
85
   Q_INVOKABLE uint enabledCount    (                                ) const;
 
86
 
 
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;
 
96
 
 
97
private:
 
98
   static const TypedStateMachine< TypedStateMachine< bool , Call::State > , UserActionModel::Action > availableActionMap;
 
99
 
 
100
   //Attribues
 
101
   Call* m_pCall;
 
102
 
 
103
private Q_SLOTS:
 
104
   void slotStateChanged();
 
105
 
 
106
Q_SIGNALS:
 
107
   void actionStateChanged();
 
108
};
 
109
// Q_DECLARE_METATYPE(UserActionModel*)
 
110
 
 
111
#endif