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 HISTORYTIMECATEGORYMODEL_H
19
#define HISTORYTIMECATEGORYMODEL_H
22
#include <QtCore/QAbstractListModel>
23
#include <QtCore/QVector>
24
#include <QtCore/QString>
26
class LIB_EXPORT HistoryTimeCategoryModel : public QAbstractListModel {
29
///@enum HistoryConst: History categories
30
enum class HistoryConst : int {
43
Three_months_ago = 12 ,
44
Four_months_ago = 13 ,
45
Five_months_ago = 14 ,
47
Seven_months_ago = 16 ,
48
Eight_months_ago = 17 ,
49
Nine_months_ago = 18 ,
51
Eleven_months_ago = 20 ,
52
Twelve_months_ago = 21 ,
54
Very_long_time_ago= 23 ,
60
explicit HistoryTimeCategoryModel(QObject* parent = nullptr);
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);
69
static QString indexToName(int idx);
72
static HistoryConst timeToHistoryConst (const time_t time);
73
static QString timeToHistoryCategory(const time_t time);
76
static QVector<QString> m_lCategories;
77
static HistoryTimeCategoryModel* m_spInstance;