summary refs log tree commit diff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-10-24 18:08:42 +0200
committerGitHub <noreply@github.com>2020-10-24 18:08:42 +0200
commit592bf42640683a3b028bfb72870e14b026794902 (patch)
tree2e26306f685644f3e819d283939f8f9963156057 /src/MainWindow.cpp
parentAdd mobile mode which improves scrolling (diff)
parentAdd option for unique config (diff)
downloadnheko-592bf42640683a3b028bfb72870e14b026794902.tar.xz
Merge pull request #306 from LorenDB/master
Add option for separate profiles
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp

index b6ad8bbe..c019b24b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp
@@ -53,10 +53,11 @@ MainWindow *MainWindow::instance_ = nullptr; -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) +MainWindow::MainWindow(const QString profile, QWidget *parent) + : QMainWindow(parent), + profile_{ profile } { - setWindowTitle("nheko"); + setWindowTitle(0); setObjectName("MainWindow"); modal_ = new OverlayModal(this); @@ -104,7 +105,7 @@ MainWindow::MainWindow(QWidget *parent) connect( chat_page_, &ChatPage::showOverlayProgressBar, this, &MainWindow::showOverlayProgressBar); connect( - chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString))); + chat_page_, &ChatPage::unreadMessages, this, &MainWindow::setWindowTitle); connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int))); connect(chat_page_, &ChatPage::showLoginPage, this, [this](const QString &msg) { login_page_->loginError(msg); @@ -179,6 +180,19 @@ MainWindow::MainWindow(QWidget *parent) } void +MainWindow::setWindowTitle(int notificationCount) +{ + QString name = "nheko"; + if (!profile_.isEmpty()) + name += " | " + profile_; + if (notificationCount > 0) + { + name.append(QString{" (%1)"}.arg(notificationCount)); + } + QMainWindow::setWindowTitle(name); +} + +void MainWindow::showEvent(QShowEvent *event) { adjustSideBars();