Mercurial > minori
annotate include/core/session.h @ 307:8769c5d50b06
pages/anime_list: don't call GUI functions in a non-GUI thread
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 19 May 2024 18:25:14 -0400 |
parents | ac1451035c85 |
children | 34347fd2a2de |
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 |
10 | 7 #include <QElapsedTimer> |
8 | |
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
195
diff
changeset
|
9 #include "semver/semver.hpp" |
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
195
diff
changeset
|
10 |
291 | 11 #include <atomic> |
250 | 12 |
10 | 13 struct Session { |
258 | 14 public: |
15 Session() { timer.start(); } | |
16 /* we literally *cannot* be lying to the user by doing this */ | |
17 void IncrementRequests() { requests++; }; | |
291 | 18 unsigned int GetRequests() { return requests; }; |
258 | 19 int uptime() { return timer.elapsed(); } |
10 | 20 |
258 | 21 Config config; |
22 static constexpr semver::version version{PACKAGE_VERSION}; | |
118
39521c47c7a3
*: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
23 |
258 | 24 private: |
291 | 25 /* IncrementRequests() gets called by different threads */ |
26 std::atomic<unsigned int> requests = 0; | |
258 | 27 QElapsedTimer timer; |
10 | 28 }; |
29 | |
30 extern Session session; | |
31 | |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
32 #endif // MINORI_CORE_SESSION_H_ |