133b3ad41f4a9339e99a2e91d6ca9e915f55893b
[mdictionary] / src / include / History.h
1 /*******************************************************************************
2
3     This file is part of mDictionary.
4
5     mDictionary is free software: you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation, either version 3 of the License, or
8     (at your option) any later version.
9
10     mDictionary 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
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
17
18     Copyright 2010 Comarch S.A.
19
20 *******************************************************************************/
21
22 //Created by Mateusz Półrola
23
24 #ifndef HISTORY_H
25 #define HISTORY_H
26
27 #include <QObject>
28 #include <QVector>
29 #include <QStringList>
30
31 class History : public QObject
32 {
33     Q_OBJECT
34 public:
35     explicit History(int maxSize = 5, QObject *parent = 0);
36
37 Q_SIGNALS:
38     void historyChanged(bool prevAvailable,
39                         bool nextAvailable,
40                         bool listAvailable);
41
42 public Q_SLOTS:
43     void refreshStatus();
44
45 public:
46     void add(QString);
47     QString previous();
48     QString next();
49     QStringList list();
50
51     bool prevAvailable();
52     bool nextAvailable();
53     bool listAvailable();
54
55     void setCurrentElement(int element);
56
57     int maxSize();
58
59     void setMaxSize(int size);
60
61 private:
62     QVector<QString> _history;
63     int _maxSize;
64     int currentElement;
65     bool _prevAvailable;
66     bool _nextAvailable;
67     bool _listAvailable;
68 };
69
70 #endif // HISTORY_H