Mercurial > minori
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/core/session.cc Tue Jun 11 14:16:40 2024 -0400 @@ -0,0 +1,40 @@ +#include "core/session.h" +#include "core/strings.h" +#include "core/config.h" +#include "gui/window.h" +#include "gui/locale.h" + +#include <QElapsedTimer> +#include <QStatusBar> + +#include "semver/semver.hpp" + +#include <atomic> + +Session session; + +Session::Session() { + timer_.start(); +} + +void Session::SetMainWindow(MainWindow* window) { + disconnect(); + window_ = window; + connect(this, &Session::StatusBarChange, window_, &MainWindow::SetStatusMessage); +} + +void Session::SetStatusBar(const std::string& message) { + emit StatusBarChange(message); +} + +void Session::IncrementRequests() { + requests_++; +}; + +unsigned int Session::GetRequests() { + return requests_; +}; + +int Session::uptime() { + return timer_.elapsed(); +}