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. |
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 |