src/messagelog.h

Tue, 30 Jul 2013 07:38:08 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 30 Jul 2013 07:38:08 +0300
changeset 402
ec95fc95e5f3
parent 351
6fdd32c4886c
child 405
b8c813906ac0
permissions
-rw-r--r--

Renamed vector to List, changed it to wrap around std::deque.

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

mercurial