src/messagelog.h

changeset 667
31540c1f22ea
parent 606
3dd6f343ec06
equal deleted inserted replaced
666:c595cfb4791c 667:31540c1f22ea
1 /* 1 /*
2 * LDForge: LDraw parts authoring CAD 2 * LDForge: LDraw parts authoring CAD
3 * Copyright (C) 2013 Santeri Piippo 3 * Copyright (C) 2013, 2014 Santeri Piippo
4 * 4 *
5 * This program is free software: you can redistribute it and/or modify 5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 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 7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 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/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #ifndef MESSAGELOG_H 19 #ifndef LDFORGE_MESSAGELOG_H
20 #define MESSAGELOG_H 20 #define LDFORGE_MESSAGELOG_H
21 21
22 #include <QObject> 22 #include <QObject>
23 #include <QDate> 23 #include <QDate>
24 #include "common.h" 24 #include "main.h"
25 #include "types.h" 25 #include "types.h"
26 26
27 class GLRenderer; 27 class GLRenderer;
28 class QTimer; 28 class QTimer;
29 29
36 * where each line's expiry is checked for. Lines begin to fade out when nearing 36 * where each line's expiry is checked for. Lines begin to fade out when nearing
37 * their expiry. If the message manager's lines change, the renderer undergoes 37 * their expiry. If the message manager's lines change, the renderer undergoes
38 * repainting. 38 * repainting.
39 */ 39 */
40 class MessageManager : public QObject 40 class MessageManager : public QObject
41 { Q_OBJECT 41 {
42 PROPERTY (GLRenderer*, renderer, setRenderer) 42 Q_OBJECT
43 PROPERTY (public, GLRenderer*, Renderer, NO_OPS, STOCK_WRITE)
43 44
44 public: 45 public:
45 // Single line of the message log. 46 // Single line of the message log.
46 class Line 47 class Line
47 { public: 48 {
48 Line (str text); 49 public:
50 Line (QString text);
49 bool update (bool& changed); 51 bool update (bool& changed);
50 52
51 str text; 53 QString text;
52 float alpha; 54 float alpha;
53 QDateTime expiry; 55 QDateTime expiry;
54 }; 56 };
55 57
56 explicit MessageManager (QObject* parent = 0); 58 explicit MessageManager (QObject* parent = 0);
57 void addLine (str line); 59 void addLine (QString line);
58 const QList<Line>& getLines() const; 60 const QList<Line>& getLines() const;
59 61
60 private: 62 private:
61 QList<Line> m_lines; 63 QList<Line> m_lines;
62 QTimer* m_ticker; 64 QTimer* m_ticker;
63 65
64 private slots: 66 private slots:
65 void tick(); 67 void tick();
66 }; 68 };
67 69
68 #endif // MESSAGELOG_H 70 #endif // LDFORGE_MESSAGELOG_H

mercurial