src/msglog.h

Thu, 04 Jul 2013 03:05:39 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 04 Jul 2013 03:05:39 +0300
changeset 322
5e701c3c3d8e
permissions
-rw-r--r--

Re-added the message log, now draws into the viewport

322
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef MSGLOG_H
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define MSGLOG_H
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QObject>
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QDate>
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "common.h"
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "types.h"
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 class GLRenderer;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 class QTimer;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 class MessageManager : public QObject
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 {
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 Q_OBJECT
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 PROPERTY( GLRenderer*, renderer, setRenderer )
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 public:
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 class Line
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 {
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 public:
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 Line( str text );
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 bool update( bool& changed );
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 str text;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 float alpha;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 QDateTime expiry;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 };
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 typedef vector<Line>::it it;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 typedef vector<Line>::c_it c_it;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 explicit MessageManager( QObject* parent = 0 );
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 void addLine( str line );
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 c_it begin() const;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 c_it end() const;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 MessageManager& operator<<( str line );
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 private:
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 vector<Line> m_lines;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 QTimer* m_ticker;
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 private slots:
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 void tick();
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 };
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 #endif // MSGLOG_H

mercurial