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

« back to all changes in this revision

Viewing changes to kde/src/lib/historytimecategorymodel.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) 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 HISTORYTIMECATEGORYMODEL_H
 
19
#define HISTORYTIMECATEGORYMODEL_H
 
20
#include "typedefs.h"
 
21
 
 
22
#include <QtCore/QAbstractListModel>
 
23
#include <QtCore/QVector>
 
24
#include <QtCore/QString>
 
25
 
 
26
class LIB_EXPORT HistoryTimeCategoryModel : public QAbstractListModel {
 
27
   Q_OBJECT
 
28
public:
 
29
   ///@enum HistoryConst: History categories
 
30
   enum class HistoryConst : int {
 
31
      Today             = 0  ,
 
32
      Yesterday         = 1  ,
 
33
      Two_days_ago      = 2  ,
 
34
      Three_days_ago    = 3  ,
 
35
      Four_days_ago     = 4  ,
 
36
      Five_days_ago     = 5  ,
 
37
      Six_days_ago      = 6  ,
 
38
      Last_week         = 7  ,
 
39
      Two_weeks_ago     = 8  ,
 
40
      Three_weeks_ago   = 9  ,
 
41
      Last_month        = 10 ,
 
42
      Two_months_ago    = 11 ,
 
43
      Three_months_ago  = 12 ,
 
44
      Four_months_ago   = 13 ,
 
45
      Five_months_ago   = 14 ,
 
46
      Six_months_ago    = 15 ,
 
47
      Seven_months_ago  = 16 ,
 
48
      Eight_months_ago  = 17 ,
 
49
      Nine_months_ago   = 18 ,
 
50
      Ten_months_ago    = 19 ,
 
51
      Eleven_months_ago = 20 ,
 
52
      Twelve_months_ago = 21 ,
 
53
      Last_year         = 22 ,
 
54
      Very_long_time_ago= 23 ,
 
55
      Never             = 24 ,
 
56
   };
 
57
   Q_ENUMS(HistoryConst)
 
58
   
 
59
   //Constructor
 
60
   explicit HistoryTimeCategoryModel(QObject* parent = nullptr);
 
61
 
 
62
   //Abstract model member
 
63
   virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole ) const;
 
64
   virtual int rowCount(const QModelIndex& parent = QModelIndex()             ) const;
 
65
   virtual Qt::ItemFlags flags(const QModelIndex& index                       ) const;
 
66
   virtual bool setData(const QModelIndex& index, const QVariant &value, int role);
 
67
 
 
68
   //Getters
 
69
   static QString indexToName(int idx);
 
70
 
 
71
   //Helpers
 
72
   static HistoryConst timeToHistoryConst   (const time_t time);
 
73
   static QString      timeToHistoryCategory(const time_t time);
 
74
 
 
75
private:
 
76
   static QVector<QString> m_lCategories;
 
77
   static HistoryTimeCategoryModel* m_spInstance;
 
78
};
 
79
 
 
80
#endif