From 3a2e798254e5de44297a5e1824ce1ff7d518f372 Mon Sep 17 00:00:00 2001 From: Jimi Huotari Date: Sat, 26 Oct 2019 19:56:16 +0300 Subject: [PATCH] feat: Add username to tray menu Closes: https://github.com/qTox/qTox/issues/5880 --- src/widget/widget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 956ab0fd8..50937aaeb 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #ifdef Q_OS_MAC #include @@ -2249,7 +2250,14 @@ void Widget::onTryCreateTrayIcon() icon = std::unique_ptr(new QSystemTrayIcon); updateIcons(); trayMenu = new QMenu(this); + QLabel* trayUser = new QLabel(getUsername(), this); + QWidgetAction* trayUserAction = new QWidgetAction(trayMenu); + trayUser->setAlignment(Qt::AlignCenter); + trayUserAction->setDefaultWidget(trayUser); + + trayMenu->addAction(trayUserAction); + trayMenu->addSeparator(); // adding activate to the top, avoids accidentally clicking quit trayMenu->addAction(actionShow); trayMenu->addSeparator();