along with the main thread, the project now supports 3 additional threads. -the Session object operates in it's own thread that will take data directly from the host, process and direct it to various parts of the client. -the main GUI and client command objects will continue to operate on the main thread. -the GenFile object which is dedicated to processing GEN_FILE data to or from the host will operate in it's own thread. -last thread is for a new object called TextWorker. this object will take all of the text buffered from all of other objects and then send the text to be displayed by the main GUI in a slower, controlled manner. by building out all of these threads, the main GUI will not lag even when the host or the client itself is outputting an excessive amount of data. fixed a bug that prevented the client from being able to totally unhook a genfile command of it crashes. also reduced the default max lines from 5000 to 1000.
71 lines
2.7 KiB
C++
71 lines
2.7 KiB
C++
#include "status.h"
|
|
|
|
// This file is part of Cmdr.
|
|
|
|
// Cmdr is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Cmdr is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Cmdr under the LICENSE.md file. If not, see
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
Status::Status(QObject *parent) : Command(parent)
|
|
{
|
|
setObjectName("status");
|
|
|
|
Shared::clientCmds->insert(objectName(), this);
|
|
}
|
|
|
|
QString Status::shortText() {return tr("view the current session parameters at the client's perspective.");}
|
|
QString Status::ioText() {return tr("[none]/[text]");}
|
|
QString Status::longText() {return TXT_SeeParams;}
|
|
|
|
void Status::dataIn(const QString &argsLine)
|
|
{
|
|
Q_UNUSED(argsLine)
|
|
|
|
QString txt;
|
|
QTextStream txtOut(&txt);
|
|
|
|
txtOut << "--Local data" << endl << endl;
|
|
txtOut << " Client version : " << QCoreApplication::applicationVersion() << endl;
|
|
txtOut << " Connected? : " << boolText(*Shared::connectedToHost) << endl;
|
|
txtOut << " Address : " << *Shared::hostAddress << endl;
|
|
txtOut << " Port : " << *Shared::hostPort << endl;
|
|
|
|
if (*Shared::connectedToHost)
|
|
{
|
|
txtOut << "" << endl;
|
|
txtOut << "--Session data" << endl << endl;
|
|
txtOut << " Client address : " << Shared::socket->localAddress().toString() << endl;
|
|
txtOut << " Host address : " << Shared::socket->peerAddress().toString() << endl;
|
|
txtOut << " Session id : " << Shared::sessionId->toHex() << endl;
|
|
txtOut << " Host version : " << verText(*Shared::servMajor, *Shared::servMinor, *Shared::servPatch) << endl;
|
|
txtOut << " GEN_FILE commands : ";
|
|
|
|
QStringList genCmds = Shared::genfileCmds->values();
|
|
|
|
if (genCmds.isEmpty())
|
|
{
|
|
genCmds.sort(Qt::CaseInsensitive);
|
|
|
|
txtOut << "" << endl;
|
|
}
|
|
|
|
for (int i = 0; i < genCmds.size(); ++i)
|
|
{
|
|
if (i != 0) txtOut << " " << genCmds[i] << endl;
|
|
else txtOut << genCmds[i] << endl;
|
|
}
|
|
}
|
|
|
|
cacheTxt(TEXT, txt);
|
|
}
|