BibleTime
bthistory.h
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #pragma once
14 
15 #include <QObject>
16 
17 #include <QList>
18 #include <QString>
19 
20 
21 class CSwordKey;
22 class QAction;
23 
24 class BTHistory: public QObject {
25  Q_OBJECT
26  public:
27  BTHistory(QObject * parent);
28 
29  /**
30  * Return a list of Actions behind the current point, the first of the history list will be the
31  * last in the returned list and vice versa.
32  */
34  /**
35  * Return a list of Actions after the current point.
36  */
38 
39  public Q_SLOTS:
40  /**
41  * Add a new key to the history.
42  */
43  void add(CSwordKey* newKey);
44  /**
45  * Move the current point in history list.
46  */
47  void move(QAction*);
48  /**
49  * Go back one step in history.
50  */
51  void back();
52  /**
53  * Go forward one step in history.
54  */
55  void fw();
56 
57  Q_SIGNALS:
58  /**
59  * Signal will be sent when the history has been changed (added, moved)
60  */
61  void historyChanged(bool backEnabled, bool fwEnabled);
62  /**
63  * Signal will be sent when the current point in history has moved
64  */
65  void historyMoved(QString newKey);
66 
67  private:
68 
69  void sendChangedSignal();
70  bool class_invariant();
71 
73  int m_index = -1; //pointer to the current item; -1==empty, 0==first etc.
74  bool m_inHistoryFunction = false; //to prevent recursive behaviour
75 };
QList< QAction * > m_historyList
Definition: bthistory.h:72
void move(QAction *)
Definition: bthistory.cpp:45
BTHistory(QObject *parent)
Definition: bthistory.cpp:25
void historyMoved(QString newKey)
void fw()
Definition: bthistory.cpp:67
QList< QAction * > getFwList()
Definition: bthistory.cpp:85
bool class_invariant()
Definition: bthistory.cpp:102
void sendChangedSignal()
Definition: bthistory.cpp:95
QList< QAction * > getBackList()
Definition: bthistory.cpp:74
void back()
Definition: bthistory.cpp:60
bool m_inHistoryFunction
Definition: bthistory.h:74
void add(CSwordKey *newKey)
Definition: bthistory.cpp:29
void historyChanged(bool backEnabled, bool fwEnabled)
int m_index
Definition: bthistory.h:73