Mercurial > minori
annotate include/core/session.h @ 337:a7d4e5107531
dep/animone: REFACTOR ALL THE THINGS
1: animone now has its own syntax divergent from anisthesia,
making different platforms actually have their own sections
2: process names in animone are now called `comm' (this will
probably break things). this is what its called in bsd/linux
so I'm just going to use it everywhere
3: the X11 code now checks for the existence of a UTF-8 window title
and passes it if available
4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK!
I still actually need to test the bsd code. to be honest I'm probably
going to move all of the bsds into separate files because they're
all essentially different operating systems at this point
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 19 Jun 2024 12:51:15 -0400 |
parents | d928ec7b6a0d |
children | 1faa72660932 |
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 |
319
d928ec7b6a0d
services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents:
315
diff
changeset
|
4 #include "core/time.h" |
10 | 5 #include "core/config.h" |
108 | 6 #include "gui/locale.h" |
292 | 7 |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
8 #include <QObject> |
10 | 9 #include <QElapsedTimer> |
10 | |
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
195
diff
changeset
|
11 #include "semver/semver.hpp" |
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
195
diff
changeset
|
12 |
291 | 13 #include <atomic> |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
14 #include <string> |
319
d928ec7b6a0d
services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents:
315
diff
changeset
|
15 #include <random> |
250 | 16 |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
17 class MainWindow; |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
18 |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
19 struct Session : public QObject { |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
20 Q_OBJECT |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
21 |
258 | 22 public: |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
23 Session(); |
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 SetMainWindow(MainWindow* window); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
26 |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
27 void SetStatusBar(const std::string& message); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
28 |
258 | 29 /* 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
|
30 void IncrementRequests(); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
31 unsigned int GetRequests(); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
32 int uptime(); |
10 | 33 |
258 | 34 Config config; |
35 static constexpr semver::version version{PACKAGE_VERSION}; | |
319
d928ec7b6a0d
services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents:
315
diff
changeset
|
36 std::mt19937 gen; |
118
39521c47c7a3
*: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
37 |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
38 signals: |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
39 void StatusBarChange(const std::string& message); |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
40 |
258 | 41 private: |
291 | 42 /* IncrementRequests() gets called by different threads */ |
315
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
43 std::atomic<unsigned int> requests_ = 0; |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
44 QElapsedTimer timer_; |
34347fd2a2de
session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
292
diff
changeset
|
45 MainWindow* window_; |
10 | 46 }; |
47 | |
48 extern Session session; | |
49 | |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
50 #endif // MINORI_CORE_SESSION_H_ |