From 60bf473be7aa86be877cf80eabc4a5fad206467a Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Tue, 11 Mar 2014 02:17:24 +0200 Subject: [PATCH] Improved the adherence to code conventions after a code review. --- interface/interface_en.ts | 2 +- interface/src/XmppClient.cpp | 6 +++--- interface/src/ui/ChatWindow.cpp | 20 +++++++++---------- libraries/shared/CMakeLists.txt | 2 +- .../shared/src/DataServerAccountInfo.cpp | 7 ++----- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/interface/interface_en.ts b/interface/interface_en.ts index 5aeb683c8c..fbbe4752ea 100644 --- a/interface/interface_en.ts +++ b/interface/interface_en.ts @@ -76,7 +76,7 @@ - + %1 online now: diff --git a/interface/src/XmppClient.cpp b/interface/src/XmppClient.cpp index a3716c781e..de0a47c28a 100644 --- a/interface/src/XmppClient.cpp +++ b/interface/src/XmppClient.cpp @@ -15,7 +15,8 @@ const QString DEFAULT_CHAT_ROOM = "public@public-chat.highfidelity.io"; XmppClient::XmppClient() : _xmppClient(), - _xmppMUCManager() { + _xmppMUCManager() +{ AccountManager& accountManager = AccountManager::getInstance(); connect(&accountManager, SIGNAL(accessTokenChanged()), this, SLOT(connectToServer())); connect(&accountManager, SIGNAL(logoutComplete()), this, SLOT(disconnectFromServer())); @@ -49,8 +50,7 @@ void XmppClient::connectToServer() { _xmppClient.connectToServer(user + "@" + DEFAULT_XMPP_SERVER, password); } -void XmppClient::disconnectFromServer() -{ +void XmppClient::disconnectFromServer() { if (_xmppClient.isConnected()) { _xmppClient.disconnectFromServer(); } diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 3d0c140b0d..c857ddc8c9 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -15,13 +15,13 @@ #include #include -#include "ChatWindow.h" -#include "ui_chatWindow.h" +#include "Application.h" #include "FlowLayout.h" #include "qtimespan.h" +#include "ui_chatWindow.h" +#include "XmppClient.h" -#include -#include +#include "ChatWindow.h" const int NUM_MESSAGES_TO_TIME_STAMP = 20; @@ -30,7 +30,8 @@ const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)"); ChatWindow::ChatWindow() : QDialog(Application::getInstance()->getGLWidget(), Qt::Tool), ui(new Ui::ChatWindow), - numMessagesAfterLastTimeStamp(0) { + numMessagesAfterLastTimeStamp(0) +{ ui->setupUi(this); FlowLayout* flowLayout = new FlowLayout(0, 4, 4); @@ -47,8 +48,7 @@ ChatWindow::ChatWindow() : connect(publicChatRoom, SIGNAL(participantsChanged()), this, SLOT(participantsChanged())); ui->connectingToXMPPLabel->hide(); startTimerForTimeStamps(); - } - else { + } else { ui->numOnlineLabel->hide(); ui->usersWidget->hide(); ui->messagesScrollArea->hide(); @@ -118,8 +118,7 @@ void ChatWindow::addTimeStamp() { numMessagesAfterLastTimeStamp = 0; } -void ChatWindow::startTimerForTimeStamps() -{ +void ChatWindow::startTimerForTimeStamps() { QTimer* timer = new QTimer(this); timer->setInterval(10 * 60 * 1000); connect(timer, SIGNAL(timeout()), this, SLOT(timeout())); @@ -191,8 +190,7 @@ void ChatWindow::messageReceived(const QXmppMessage& message) { ++numMessagesAfterLastTimeStamp; if (message.stamp().isValid()) { lastMessageStamp = message.stamp().toLocalTime(); - } - else { + } else { lastMessageStamp = QDateTime::currentDateTime(); } } diff --git a/libraries/shared/CMakeLists.txt b/libraries/shared/CMakeLists.txt index be18a3ba45..3af7272cc1 100644 --- a/libraries/shared/CMakeLists.txt +++ b/libraries/shared/CMakeLists.txt @@ -32,4 +32,4 @@ if (UNIX AND NOT APPLE) target_link_libraries(${TARGET_NAME} "${CMAKE_THREAD_LIBS_INIT}") endif (UNIX AND NOT APPLE) -target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets Qt5::Xml) +target_link_libraries(${TARGET_NAME} Qt5::Network Qt5::Widgets) diff --git a/libraries/shared/src/DataServerAccountInfo.cpp b/libraries/shared/src/DataServerAccountInfo.cpp index 2bcd2dbcd0..1884517515 100644 --- a/libraries/shared/src/DataServerAccountInfo.cpp +++ b/libraries/shared/src/DataServerAccountInfo.cpp @@ -56,12 +56,9 @@ void DataServerAccountInfo::setUsername(const QString& username) { } } -void DataServerAccountInfo::setXMPPPassword(const QString& xmppPassword) -{ +void DataServerAccountInfo::setXMPPPassword(const QString& xmppPassword) { if (_xmppPassword != xmppPassword) { _xmppPassword = xmppPassword; - - qDebug() << "XMPP password changed to " << xmppPassword; } } @@ -73,4 +70,4 @@ QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) { QDataStream& operator>>(QDataStream &in, DataServerAccountInfo& info) { in >> info._accessToken >> info._username >> info._xmppPassword; return in; -} \ No newline at end of file +}