Mercurial > minori
annotate include/core/session.h @ 315:34347fd2a2de
session: allow printing status messages
...!
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 11 Jun 2024 14:16:40 -0400 |
parents | ac1451035c85 |
children | d928ec7b6a0d |
rev | line source |
---|---|
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
1 #ifndef MINORI_CORE_SESSION_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
2 #define MINORI_CORE_SESSION_H_ |
85 | 3 |
10 | 4 #include "core/config.h" |
108 | 5 #include "gui/locale.h" |
292 | 6 |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
7 #include <QObject> |
10 | 8 #include <QElapsedTimer> |
9 | |
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
195
diff
changeset
|
10 #include "semver/semver.hpp" |
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
195
diff
changeset
|
11 |
291 | 12 #include <atomic> |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
13 #include <string> |
250 | 14 |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
15 class MainWindow; |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
16 |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
17 struct Session : public QObject { |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
18 Q_OBJECT |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
19 |
258 | 20 public: |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
21 Session(); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
22 |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
23 void SetMainWindow(MainWindow* window); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
24 |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
25 void SetStatusBar(const std::string& message); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
26 |
258 | 27 /* we literally *cannot* be lying to the user by doing this */ |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
28 void IncrementRequests(); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
29 unsigned int GetRequests(); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
30 int uptime(); |
10 | 31 |
258 | 32 Config config; |
33 static constexpr semver::version version{PACKAGE_VERSION}; | |
118
39521c47c7a3
*: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
34 |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
35 signals: |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
36 void StatusBarChange(const std::string& message); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
37 |
258 | 38 private: |
291 | 39 /* IncrementRequests() gets called by different threads */ |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
40 std::atomic<unsigned int> requests_ = 0; |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
41 QElapsedTimer timer_; |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
42 MainWindow* window_; |
10 | 43 }; |
44 | |
45 extern Session session; | |
46 | |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
47 #endif // MINORI_CORE_SESSION_H_ |