added option --debug-output to redirect client output to file
This commit is contained in:
parent
40d2b57de9
commit
fd5be3d525
3 changed files with 7 additions and 3 deletions
|
@ -72,8 +72,10 @@ void installNewTranslator()
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// qInstallMsgHandler(myMessageOutput);
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
if (app.arguments().contains("--debug-output"))
|
||||||
|
qInstallMsgHandler(myMessageOutput);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QDir baseDir(app.applicationDirPath());
|
QDir baseDir(app.applicationDirPath());
|
||||||
baseDir.cdUp();
|
baseDir.cdUp();
|
||||||
|
|
|
@ -112,7 +112,7 @@ void RemoteClient::readData()
|
||||||
|
|
||||||
ServerMessage newServerMessage;
|
ServerMessage newServerMessage;
|
||||||
newServerMessage.ParseFromArray(inputBuffer.data(), messageLength);
|
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);
|
inputBuffer.remove(0, messageLength);
|
||||||
messageInProgress = false;
|
messageInProgress = false;
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ void RemoteClient::sendCommandContainer(const CommandContainer &cont)
|
||||||
{
|
{
|
||||||
QByteArray buf;
|
QByteArray buf;
|
||||||
unsigned int size = cont.ByteSize();
|
unsigned int size = cont.ByteSize();
|
||||||
|
qDebug(("OUT " + QString::number(size) + ": " + QString::fromStdString(cont.DebugString())).toUtf8());
|
||||||
buf.resize(size + 4);
|
buf.resize(size + 4);
|
||||||
cont.SerializeToArray(buf.data() + 4, size);
|
cont.SerializeToArray(buf.data() + 4, size);
|
||||||
buf.data()[3] = (unsigned char) size;
|
buf.data()[3] = (unsigned char) size;
|
||||||
|
|
|
@ -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::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::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;
|
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()) {
|
switch (client->getStatus()) {
|
||||||
case StatusConnecting: setWindowTitle(appName + " - " + tr("Connecting to %1...").arg(client->peerName())); break;
|
case StatusConnecting: setWindowTitle(appName + " - " + tr("Connecting to %1...").arg(client->peerName())); break;
|
||||||
case StatusDisconnected: setWindowTitle(appName + " - " + tr("Disconnected")); 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;
|
case StatusLoggedIn: setWindowTitle(appName + " - " + tr("Logged in at %1").arg(client->peerName())); break;
|
||||||
default: setWindowTitle(appName);
|
default: setWindowTitle(appName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue