update window title when changing accounts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "widgets/window.hpp"
|
||||
#include "accountmanager.hpp"
|
||||
#include "channelmanager.hpp"
|
||||
#include "colorscheme.hpp"
|
||||
#include "settingsmanager.hpp"
|
||||
@@ -25,6 +26,15 @@ Window::Window(const QString &_windowName, ChannelManager &_channelManager,
|
||||
{
|
||||
this->initAsWindow();
|
||||
|
||||
AccountManager::getInstance().Twitch.currentUsername.connect(
|
||||
[this](const std::string &newUsername, auto) {
|
||||
if (newUsername.empty()) {
|
||||
this->refreshWindowTitle("Not logged in");
|
||||
} else {
|
||||
this->refreshWindowTitle(QString::fromStdString(newUsername));
|
||||
}
|
||||
});
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
|
||||
// add titlebar
|
||||
@@ -110,6 +120,11 @@ Notebook &Window::getNotebook()
|
||||
return this->notebook;
|
||||
}
|
||||
|
||||
void Window::refreshWindowTitle(const QString &username)
|
||||
{
|
||||
this->setWindowTitle(username + " - Chatterino for Twitch");
|
||||
}
|
||||
|
||||
void Window::closeEvent(QCloseEvent *)
|
||||
{
|
||||
const QRect &geom = this->geometry();
|
||||
|
||||
Reference in New Issue
Block a user