mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
update window title when changing accounts
This commit is contained in:
parent
e46357ad9b
commit
bf39851776
2 changed files with 17 additions and 0 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue