From 4cbffc3f6dc850f6f1dc8de600d45dc89199815a Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Tue, 3 Mar 2015 13:09:41 +0100 Subject: [PATCH] Added username to window title While having more than 1 client open I found it hard to know which user was which. I have added the user name to the title bar so you know who you are logged in as. --- cockatrice/src/abstractclient.h | 2 ++ cockatrice/src/window_main.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/abstractclient.h b/cockatrice/src/abstractclient.h index 4dc9af2b..6f3b7ede 100644 --- a/cockatrice/src/abstractclient.h +++ b/cockatrice/src/abstractclient.h @@ -82,6 +82,8 @@ public: ClientStatus getStatus() const { QMutexLocker locker(&clientMutex); return status; } void sendCommand(const CommandContainer &cont); void sendCommand(PendingCommand *pend); + + const QString getUserName() {return userName;} static PendingCommand *prepareSessionCommand(const ::google::protobuf::Message &cmd); static PendingCommand *prepareRoomCommand(const ::google::protobuf::Message &cmd, int roomId); diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index b0878340..7f1c16f1 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -287,7 +287,7 @@ void MainWindow::setClientStatusTitle() case StatusConnecting: setWindowTitle(appName + " - " + tr("Connecting to %1...").arg(client->peerName())); break; case StatusDisconnected: setWindowTitle(appName + " - " + tr("Disconnected")); break; case StatusLoggingIn: setWindowTitle(appName + " - " + tr("Connected, logging in at %1").arg(client->peerName())); break; - case StatusLoggedIn: setWindowTitle(appName + " - " + tr("Logged in at %1").arg(client->peerName())); break; + case StatusLoggedIn: setWindowTitle(appName + " - " + tr("Logged in as %1 at %2").arg(client->getUserName()).arg(client->peerName())); break; default: setWindowTitle(appName); } }