Convert rest of source to 4-space indent

This commit is contained in:
Matt Kelly 2014-02-11 11:14:19 -05:00
parent a171df744d
commit 1bc48a7849
146 changed files with 12810 additions and 12810 deletions

View file

@ -13,100 +13,100 @@
#include "pb/serverinfo_user.pb.h"
TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &_ownUserInfo, const ServerInfo_User &_otherUserInfo)
: Tab(_tabSupervisor), client(_client), ownUserInfo(new ServerInfo_User(_ownUserInfo)), otherUserInfo(new ServerInfo_User(_otherUserInfo)), userOnline(true)
: Tab(_tabSupervisor), client(_client), ownUserInfo(new ServerInfo_User(_ownUserInfo)), otherUserInfo(new ServerInfo_User(_otherUserInfo)), userOnline(true)
{
chatView = new ChatView(tabSupervisor, 0, true);
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
sayEdit = new QLineEdit;
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(chatView);
vbox->addWidget(sayEdit);
aLeave = new QAction(this);
connect(aLeave, SIGNAL(triggered()), this, SLOT(actLeave()));
chatView = new ChatView(tabSupervisor, 0, true);
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
sayEdit = new QLineEdit;
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(chatView);
vbox->addWidget(sayEdit);
aLeave = new QAction(this);
connect(aLeave, SIGNAL(triggered()), this, SLOT(actLeave()));
messageMenu = new QMenu(this);
messageMenu->addAction(aLeave);
addTabMenu(messageMenu);
messageMenu = new QMenu(this);
messageMenu->addAction(aLeave);
addTabMenu(messageMenu);
retranslateUi();
setLayout(vbox);
retranslateUi();
setLayout(vbox);
}
TabMessage::~TabMessage()
{
emit talkClosing(this);
delete ownUserInfo;
delete otherUserInfo;
emit talkClosing(this);
delete ownUserInfo;
delete otherUserInfo;
}
void TabMessage::retranslateUi()
{
messageMenu->setTitle(tr("Personal &talk"));
aLeave->setText(tr("&Leave"));
messageMenu->setTitle(tr("Personal &talk"));
aLeave->setText(tr("&Leave"));
}
QString TabMessage::getUserName() const
{
return QString::fromStdString(otherUserInfo->name());
return QString::fromStdString(otherUserInfo->name());
}
QString TabMessage::getTabText() const
{
return tr("Talking to %1").arg(QString::fromStdString(otherUserInfo->name()));
return tr("Talking to %1").arg(QString::fromStdString(otherUserInfo->name()));
}
void TabMessage::closeRequest()
{
actLeave();
actLeave();
}
void TabMessage::sendMessage()
{
if (sayEdit->text().isEmpty() || !userOnline)
return;
Command_Message cmd;
cmd.set_user_name(otherUserInfo->name());
cmd.set_message(sayEdit->text().toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(messageSent(const Response &)));
client->sendCommand(pend);
sayEdit->clear();
if (sayEdit->text().isEmpty() || !userOnline)
return;
Command_Message cmd;
cmd.set_user_name(otherUserInfo->name());
cmd.set_message(sayEdit->text().toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(messageSent(const Response &)));
client->sendCommand(pend);
sayEdit->clear();
}
void TabMessage::messageSent(const Response &response)
{
if (response.response_code() == Response::RespInIgnoreList)
chatView->appendMessage(tr("This user is ignoring you."));
if (response.response_code() == Response::RespInIgnoreList)
chatView->appendMessage(tr("This user is ignoring you."));
}
void TabMessage::actLeave()
{
deleteLater();
deleteLater();
}
void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
{
const UserLevelFlags userLevel(event.sender_name() == otherUserInfo->name() ? otherUserInfo->user_level() : ownUserInfo->user_level());
chatView->appendMessage(QString::fromStdString(event.message()), QString::fromStdString(event.sender_name()), userLevel);
emit userEvent();
const UserLevelFlags userLevel(event.sender_name() == otherUserInfo->name() ? otherUserInfo->user_level() : ownUserInfo->user_level());
chatView->appendMessage(QString::fromStdString(event.message()), QString::fromStdString(event.sender_name()), userLevel);
emit userEvent();
}
void TabMessage::processUserLeft()
{
chatView->appendMessage(tr("%1 has left the server.").arg(QString::fromStdString(otherUserInfo->name())));
userOnline = false;
chatView->appendMessage(tr("%1 has left the server.").arg(QString::fromStdString(otherUserInfo->name())));
userOnline = false;
}
void TabMessage::processUserJoined(const ServerInfo_User &_userInfo)
{
chatView->appendMessage(tr("%1 has joined the server.").arg(QString::fromStdString(otherUserInfo->name())));
userOnline = true;
*otherUserInfo = _userInfo;
chatView->appendMessage(tr("%1 has joined the server.").arg(QString::fromStdString(otherUserInfo->name())));
userOnline = true;
*otherUserInfo = _userInfo;
}