Added account name to window title (#1771)

This commit is contained in:
Paweł 2020-07-05 14:04:39 +02:00 committed by GitHub
parent 1277c72b02
commit 208e7a68b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 10 deletions

View file

@ -388,24 +388,34 @@ void Window::onAccountSelected()
{ {
auto user = getApp()->accounts->twitch.getCurrent(); auto user = getApp()->accounts->twitch.getCurrent();
// update title // update title (also append username on Linux and MacOS)
this->setWindowTitle(Version::instance().fullVersion()); QString windowTitle = Version::instance().fullVersion();
// update user #if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
if (user->isAnon()) if (user->isAnon())
{ {
if (this->userLabel_) windowTitle += " - not logged in";
{
this->userLabel_->getLabel().setText("anonymous");
}
} }
else else
{ {
if (this->userLabel_) windowTitle += " - " + user->getUserName();
}
#endif
this->setWindowTitle(windowTitle);
// update user
if (this->userLabel_)
{
if (user->isAnon())
{
this->userLabel_->getLabel().setText("anonymous");
}
else
{ {
this->userLabel_->getLabel().setText(user->getUserName()); this->userLabel_->getLabel().setText(user->getUserName());
} }
} }
} // namespace chatterino }
} // namespace chatterino } // namespace chatterino

View file

@ -307,7 +307,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Restart on crash", s.restartOnCrash); layout.addCheckbox("Restart on crash", s.restartOnCrash);
if (!BaseWindow::supportsCustomWindowFrame()) if (!BaseWindow::supportsCustomWindowFrame())
{ {
layout.addCheckbox("Show preferences button (ctrl+p to show)", layout.addCheckbox("Show preferences button (Ctrl+P to show)",
s.hidePreferencesButton, true); s.hidePreferencesButton, true);
layout.addCheckbox("Show user button", s.hideUserButton, true); layout.addCheckbox("Show user button", s.hideUserButton, true);
} }