Mercurial > minori
comparison src/core/session.cc @ 315:34347fd2a2de
session: allow printing status messages
...!
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 11 Jun 2024 14:16:40 -0400 |
parents | |
children | d928ec7b6a0d |
comparison
equal
deleted
inserted
replaced
314:76d7315504c4 | 315:34347fd2a2de |
---|---|
1 #include "core/session.h" | |
2 #include "core/strings.h" | |
3 #include "core/config.h" | |
4 #include "gui/window.h" | |
5 #include "gui/locale.h" | |
6 | |
7 #include <QElapsedTimer> | |
8 #include <QStatusBar> | |
9 | |
10 #include "semver/semver.hpp" | |
11 | |
12 #include <atomic> | |
13 | |
14 Session session; | |
15 | |
16 Session::Session() { | |
17 timer_.start(); | |
18 } | |
19 | |
20 void Session::SetMainWindow(MainWindow* window) { | |
21 disconnect(); | |
22 window_ = window; | |
23 connect(this, &Session::StatusBarChange, window_, &MainWindow::SetStatusMessage); | |
24 } | |
25 | |
26 void Session::SetStatusBar(const std::string& message) { | |
27 emit StatusBarChange(message); | |
28 } | |
29 | |
30 void Session::IncrementRequests() { | |
31 requests_++; | |
32 }; | |
33 | |
34 unsigned int Session::GetRequests() { | |
35 return requests_; | |
36 }; | |
37 | |
38 int Session::uptime() { | |
39 return timer_.elapsed(); | |
40 } |