annotate src/core/session.cc @ 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
315
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
1 #include "core/session.h"
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
2 #include "core/strings.h"
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
3 #include "core/config.h"
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
4 #include "gui/window.h"
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
5 #include "gui/locale.h"
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
6
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
7 #include <QElapsedTimer>
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
8 #include <QStatusBar>
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
9
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
10 #include "semver/semver.hpp"
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
11
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
12 #include <atomic>
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
13
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
14 Session session;
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
15
319
d928ec7b6a0d services/kitsu: implement GetAnimeList()
Paper <paper@paper.us.eu.org>
parents: 315
diff changeset
16 Session::Session() : gen(Time::GetSystemTime()) {
315
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
17 timer_.start();
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
18 }
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
19
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
20 void Session::SetMainWindow(MainWindow* window) {
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
21 disconnect();
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
22 window_ = window;
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
23 connect(this, &Session::StatusBarChange, window_, &MainWindow::SetStatusMessage);
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
24 }
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
25
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
26 void Session::SetStatusBar(const std::string& message) {
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
27 emit StatusBarChange(message);
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
28 }
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
29
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
30 void Session::IncrementRequests() {
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
31 requests_++;
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
32 };
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
33
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
34 unsigned int Session::GetRequests() {
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
35 return requests_;
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
36 };
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
37
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
38 int Session::uptime() {
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
39 return timer_.elapsed();
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents:
diff changeset
40 }