refs #199, extended core to new functionality

* enable/disable signal/slot log
* redirection of output as qDebug, qWarning, ..
This commit is contained in:
Klaus Basan
2014-04-08 18:19:27 +02:00
parent 35b489d89a
commit 429f79f841
3 changed files with 57 additions and 15 deletions

View File

@@ -3,6 +3,7 @@
#include "blackcore/context_network.h"
#include "blackcore/context_audio.h"
#include "blackcore/context_settings.h"
#include "blackcore/context_application.h"
#include "blackmisc/valuemap.h"
#include "blackmisc/avallclasses.h"
#include "blackmisc/pqallquantities.h"
@@ -31,8 +32,9 @@ namespace BlackMiscTest
/*
* Send data to testservice, this sends data to the slots on the server
*/
void Tool::serverLoop(const BlackCore::CRuntime *runtime)
void Tool::serverLoop(BlackCore::CRuntime *runtime)
{
Q_ASSERT(runtime);
QThread::sleep(3); // let the client connect
qDebug() << "Running on server here" << Tool::getPid();
@@ -41,26 +43,30 @@ namespace BlackMiscTest
//
QTextStream qtin(stdin);
QString line;
while (line != "x")
while (line != "x" && runtime)
{
const BlackCore::IContextNetwork *networkContext = runtime->getIContextNetwork();
const BlackCore::IContextAudio *audioContext = runtime->getIContextAudio();
const BlackCore::IContextSettings *settingsContext = runtime->getIContextSettings();
BlackCore::IContextApplication *applicationContext = runtime->getIContextApplication();
qDebug() << "-------------";
qDebug() << "Connected with network: " << networkContext->isConnected();
qDebug() << "-------------";
qDebug() << "Key x to exit";
qDebug() << "0 .. settings";
qDebug() << "1 .. ATC booked";
qDebug() << "2 .. ATC online";
qDebug() << "3 .. Aircrafts in range";
qDebug() << "4 .. my aircraft";
qDebug() << "5 .. voice rooms";
qDebug() << "x .. to exit 0 .. settings";
qDebug() << "1 .. ATC booked 2 .. ATC online";
qDebug() << "3 .. Aircrafts in range 4 .. my aircraft 5 .. voice rooms";
qDebug() << "-------------";
qDebug() << "oe . redirect enabled od . disable redirect";
qDebug() << "-------------";
qDebug() << "signal / slot logging:";
qDebug() << "sig + context + [e]nabled/[d]isabled";
qDebug() << "slo + context + [e]nabled/[d]isabled";
qDebug() << "contexts: app / aud / net / set / sim / all";
qDebug() << "examples: sigappd, slonete, slosimd, sloalle";
qDebug() << "-------------";
line = qtin.readLine();
if (line.startsWith("0"))
{
qDebug() << "-------------";
@@ -97,7 +103,40 @@ namespace BlackMiscTest
qDebug() << "voice rooms";
qDebug() << audioContext->getComVoiceRooms();
}
else if (line.startsWith("oe"))
{
applicationContext->setOutputRedirectionLevel(IContextApplication::RedirectAllOutput);
applicationContext->setStreamingForRedirectedOutputLevel(IContextApplication::RedirectAllOutput);
}
else if (line.startsWith("od"))
{
applicationContext->setOutputRedirectionLevel(IContextApplication::RedirectNone);
applicationContext->setStreamingForRedirectedOutputLevel(IContextApplication::RedirectNone);
}
else if (line.startsWith("sig"))
{
line.replace("sig", "");
bool enable = line.endsWith("e");
if (line.startsWith("app")) runtime->signalLogForApplication(enable);
else if (line.startsWith("aud")) runtime->signalLogForAudio(enable);
else if (line.startsWith("net")) runtime->signalLogForNetwork(enable);
else if (line.startsWith("set")) runtime->signalLogForSettings(enable);
else if (line.startsWith("sim")) runtime->signalLogForSimulator(enable);
else if (line.startsWith("all")) runtime->signalLog(enable);
}
else if (line.startsWith("slo"))
{
line.replace("slo", "");
bool enable = line.endsWith("e");
if (line.startsWith("app")) runtime->slotLogForApplication(enable);
else if (line.startsWith("aud")) runtime->slotLogForAudio(enable);
else if (line.startsWith("net")) runtime->slotLogForNetwork(enable);
else if (line.startsWith("set")) runtime->slotLogForSettings(enable);
else if (line.startsWith("sim")) runtime->slotLogForSimulator(enable);
else if (line.startsWith("all")) runtime->slotLog(enable);
}
}
runtime->gracefulShutdown();
QCoreApplication::quit();
}
} // namespace