[Companion][Simulator] Add custom qDebug message handler/formatter (#4475)

* [Companion][Simulator] Add custom qDebug message handler/formatter as an option. Keeps support for QT_MESSAGE_PATTERN env. var.

* [Simulator] Show system messages of level qInfo and above in debug console.

* [Simulator] Still capture screenshot to clipboard if path is not accessible (and screenshot results now print to simulator debug console).

* Fix for older CMake.

* [Companion] Do not start debug message handler if app is shutting down, and add null checks before using it; Increase backtrace report depth; Add OTx headers; Add Companion exit status debug; Clean up unused code.

* [Simulator] Add asynchronous FIFO buffer for handling debug output/display more efficiently. (#4488)
(cherry-picked from b12bd7d7be)
This commit is contained in:
Max Paperno
2017-03-02 18:35:00 +01:00
committed by Bertrand Songis
parent 620094e358
commit 00b2799427
14 changed files with 352 additions and 72 deletions
@@ -122,16 +122,16 @@ void SimulatedUIWidget::captureScreenshot()
if (path.isEmpty())
path = "./";
QDir dir(path);
if (!dir.exists() || !dir.isReadable()) {
// m_simulator->traceCallback("SIMULATOR ERROR - Cannot open screenshot folder, check your settings.\n");
qDebug() << "SIMULATOR ERROR - Cannot open screenshot folder, check your settings.";
return;
if (dir.exists() && dir.isReadable()) {
QStringList fwid = getCurrentFirmware()->getId().split("-", QString::SkipEmptyParts);
QString flavor = fwid.at(qMin(1, fwid.size()));
QString fnpfx = tr("screenshot", "Simulator LCD screenshot file name prefix");
fileName = "%1/%2_%3_%4.png";
fileName = fileName.arg(dir.absolutePath(), fnpfx, flavor, QDateTime::currentDateTime().toString("yy-MM-dd_HH-mm-ss"));
}
else {
qWarning() << "SIMULATOR ERROR - Cannot open screenshot folder, check your settings.";
}
QStringList fwid = getCurrentFirmware()->getId().split("-", QString::SkipEmptyParts);
QString flavor = fwid.at(qMin(1, fwid.size()));
QString fnpfx = tr("screenshot", "Simulator LCD screenshot file name prefix");
fileName = "%1/%2_%3_%4.png";
fileName = fileName.arg(dir.absolutePath(), fnpfx, flavor, QDateTime::currentDateTime().toString("yy-MM-dd_HH-mm-ss"));
}
m_lcd->makeScreenshot(fileName);
}