view src/core/session.cc @ 327:b5d6c27c308f

anime: refactor Anime::SeriesSeason to Season class ToLocalString has also been altered to take in both season and year because lots of locales actually treat formatting seasons differently! most notably is Russian which adds a suffix at the end to notate seasons(??)
author Paper <paper@paper.us.eu.org>
date Thu, 13 Jun 2024 01:49:18 -0400
parents d928ec7b6a0d
children
line wrap: on
line source

#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() : gen(Time::GetSystemTime()) {
	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();
}