update window title when changing accounts
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "widgets/window.hpp"
|
#include "widgets/window.hpp"
|
||||||
|
#include "accountmanager.hpp"
|
||||||
#include "channelmanager.hpp"
|
#include "channelmanager.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
@@ -25,6 +26,15 @@ Window::Window(const QString &_windowName, ChannelManager &_channelManager,
|
|||||||
{
|
{
|
||||||
this->initAsWindow();
|
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);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
// add titlebar
|
// add titlebar
|
||||||
@@ -110,6 +120,11 @@ Notebook &Window::getNotebook()
|
|||||||
return this->notebook;
|
return this->notebook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::refreshWindowTitle(const QString &username)
|
||||||
|
{
|
||||||
|
this->setWindowTitle(username + " - Chatterino for Twitch");
|
||||||
|
}
|
||||||
|
|
||||||
void Window::closeEvent(QCloseEvent *)
|
void Window::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
const QRect &geom = this->geometry();
|
const QRect &geom = this->geometry();
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ public:
|
|||||||
|
|
||||||
Notebook &getNotebook();
|
Notebook &getNotebook();
|
||||||
|
|
||||||
|
void refreshWindowTitle(const QString &username);
|
||||||
|
|
||||||
boost::signals2::signal<void()> closed;
|
boost::signals2::signal<void()> closed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user