Improved the adherence to code conventions after a code review.

This commit is contained in:
Dimitar Dobrev 2014-03-11 02:17:24 +02:00
parent acb2793053
commit 60bf473be7
5 changed files with 16 additions and 21 deletions

View file

@ -76,7 +76,7 @@
</translation>
</message>
<message>
<location filename="src/ui/ChatWindow.cpp" line="154"/>
<location filename="src/ui/ChatWindow.cpp" line="153"/>
<source>%1 online now:</source>
<translation type="unfinished"></translation>
</message>

View file

@ -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();
}

View file

@ -15,13 +15,13 @@
#include <QTextDocument>
#include <QTimer>
#include "ChatWindow.h"
#include "ui_chatWindow.h"
#include "Application.h"
#include "FlowLayout.h"
#include "qtimespan.h"
#include "ui_chatWindow.h"
#include "XmppClient.h"
#include <Application.h>
#include <XmppClient.h>
#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();
}
}

View file

@ -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)

View file

@ -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;
}
}