added option --debug-output to redirect client output to file

This commit is contained in:
Max-Wilhelm Bruker 2012-03-25 19:48:50 +02:00
parent 40d2b57de9
commit fd5be3d525
3 changed files with 7 additions and 3 deletions

View file

@ -72,8 +72,10 @@ void installNewTranslator()
int main(int argc, char *argv[])
{
// qInstallMsgHandler(myMessageOutput);
QApplication app(argc, argv);
if (app.arguments().contains("--debug-output"))
qInstallMsgHandler(myMessageOutput);
#ifdef Q_OS_MAC
QDir baseDir(app.applicationDirPath());
baseDir.cdUp();

View file

@ -112,7 +112,7 @@ void RemoteClient::readData()
ServerMessage newServerMessage;
newServerMessage.ParseFromArray(inputBuffer.data(), messageLength);
qDebug((QString::number(messageLength) + ": " + QString::fromStdString(newServerMessage.DebugString())).toUtf8());
qDebug(("IN " + QString::number(messageLength) + ": " + QString::fromStdString(newServerMessage.DebugString())).toUtf8());
inputBuffer.remove(0, messageLength);
messageInProgress = false;
@ -127,6 +127,7 @@ void RemoteClient::sendCommandContainer(const CommandContainer &cont)
{
QByteArray buf;
unsigned int size = cont.ByteSize();
qDebug(("OUT " + QString::number(size) + ": " + QString::fromStdString(cont.DebugString())).toUtf8());
buf.resize(size + 4);
cont.SerializeToArray(buf.data() + 4, size);
buf.data()[3] = (unsigned char) size;

View file

@ -240,7 +240,7 @@ void MainWindow::serverError(Response::ResponseCode r, QString reasonStr)
case Response::RespWrongPassword: QMessageBox::critical(this, tr("Error"), tr("Invalid login data.")); break;
case Response::RespWouldOverwriteOldSession: QMessageBox::critical(this, tr("Error"), tr("There is already an active session using this user name.\nPlease close that session first and re-login.")); break;
case Response::RespUserIsBanned: QMessageBox::critical(this, tr("Error"), tr("You are banned.\n%1").arg(reasonStr)); break;
default: ;
default: QMessageBox::critical(this, tr("Error"), tr("Unknown server error: %1").arg(static_cast<int>(r)));
}
}
@ -262,6 +262,7 @@ void MainWindow::setClientStatusTitle()
switch (client->getStatus()) {
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;
default: setWindowTitle(appName);
}