~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* 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) 2013-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 RINGTONEMODEL_H
 
19
#define RINGTONEMODEL_H
 
20
#include "typedefs.h"
 
21
 
 
22
//Qt
 
23
#include <QtCore/QString>
 
24
#include <QtCore/QAbstractTableModel>
 
25
class QTimer;
 
26
 
 
27
//SFLPhone
 
28
class Account;
 
29
 
 
30
///CredentialModel: A model for account credentials
 
31
class LIB_EXPORT RingToneModel : public QAbstractTableModel {
 
32
   Q_OBJECT
 
33
public:
 
34
 
 
35
   enum Role {
 
36
      IsPlaying = 100,
 
37
      FullPath  = 101,
 
38
   };
 
39
 
 
40
   explicit RingToneModel(Account* a);
 
41
   virtual ~RingToneModel();
 
42
 
 
43
   //Model functions
 
44
   QVariant      data        ( const QModelIndex& index, int role = Qt::DisplayRole     ) const;
 
45
   int           rowCount    ( const QModelIndex& parent = QModelIndex()                ) const;
 
46
   int           columnCount ( const QModelIndex& parent = QModelIndex()                ) const;
 
47
   Qt::ItemFlags flags       ( const QModelIndex& index                                 ) const;
 
48
   virtual bool  setData     ( const QModelIndex& index, const QVariant &value, int role)      ;
 
49
 
 
50
   //Getters
 
51
   QString     currentRingTone() const;
 
52
   QModelIndex currentIndex   () const;
 
53
 
 
54
   //Setter
 
55
   void setCurrentIndex(const QModelIndex& idx);
 
56
 
 
57
   //Mutator
 
58
   void play(const QModelIndex& index);
 
59
 
 
60
private:
 
61
   struct RingToneInfo {
 
62
      explicit RingToneInfo() : isPlaying(false),isCurrent(false){}
 
63
      QString name;
 
64
      QString path;
 
65
      bool isPlaying;
 
66
      bool isCurrent;
 
67
   };
 
68
   QList<RingToneInfo*> m_lRingTone;
 
69
   Account* m_pAccount;
 
70
   QTimer* m_pTimer;
 
71
   RingToneInfo* m_pCurrent;
 
72
 
 
73
private Q_SLOTS:
 
74
   void slotStopTimer();
 
75
};
 
76
 
 
77
#endif //RINGTONEMODEL_H