From 716858e6f69c1487cf6dae3be793a9e8bb4d3412 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Thu, 3 Apr 2014 19:45:46 +0300 Subject: [PATCH] Informed users who want to chat they have to log in first. --- interface/interface_en.ts | 33 +++++++++++++++++++-------------- interface/src/Menu.cpp | 10 ++-------- interface/src/ui/ChatWindow.cpp | 4 ++++ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/interface/interface_en.ts b/interface/interface_en.ts index afd77ecc07..192f5d4015 100644 --- a/interface/interface_en.ts +++ b/interface/interface_en.ts @@ -44,32 +44,37 @@ online now: + + + You must be logged in to chat with others. + + - + day - - + %n day + %n days - + hour - - + %n hour + %n hours - + minute - - + %n minute + %n minutes - + %1 online now: @@ -106,18 +111,18 @@ Menu - + Open .ini config file - - + + Text files (*.ini) - + Save .ini config file diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index c07dfb9222..5530c57281 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -180,18 +180,17 @@ Menu::Menu() : QMenu* toolsMenu = addMenu("Tools"); addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor())); +#ifdef HAVE_QXMPP _chatAction = addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, Qt::Key_Return, this, SLOT(showChat())); -#ifdef HAVE_QXMPP + const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient(); toggleChat(); connect(&xmppClient, SIGNAL(connected()), this, SLOT(toggleChat())); connect(&xmppClient, SIGNAL(disconnected()), this, SLOT(toggleChat())); -#else - _chatAction->setEnabled(false); #endif QMenu* viewMenu = addMenu("View"); @@ -1155,11 +1154,6 @@ void Menu::showMetavoxelEditor() { } void Menu::showChat() { - if (!_chatAction->isEnabled()) { - // Don't do anything if chat is disabled (No - // QXMPP library or xmpp is disconnected). - return; - } QMainWindow* mainWindow = Application::getInstance()->getWindow(); if (!_chatWindow) { mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow()); diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 6963c208c5..a667afddae 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -42,6 +42,10 @@ ChatWindow::ChatWindow() : ui->messagesGridLayout->setColumnStretch(1, 3); ui->messagePlainTextEdit->installEventFilter(this); + + if (!AccountManager::getInstance().isLoggedIn()) { + ui->connectingToXMPPLabel->setText(tr("You must be logged in to chat with others.")); + } #ifdef HAVE_QXMPP const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();