diff --git a/cockatrice/src/main.cpp b/cockatrice/src/main.cpp index eb10bb79..69634b6a 100644 --- a/cockatrice/src/main.cpp +++ b/cockatrice/src/main.cpp @@ -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(); diff --git a/cockatrice/src/remoteclient.cpp b/cockatrice/src/remoteclient.cpp index e8a56495..78420cbd 100644 --- a/cockatrice/src/remoteclient.cpp +++ b/cockatrice/src/remoteclient.cpp @@ -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; diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 96f3973e..7e76a0a4 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -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(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); }