[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
+11 -12
View File
@@ -26,20 +26,15 @@
#include <SDL.h>
#undef main
#endif
#include "appdebugmessagehandler.h"
#include "mainwindow.h"
#include "version.h"
#include "appdata.h"
#include "storage.h"
#if defined _MSC_VER || !defined __GNUC__
#include <windows.h>
#define sleep(x) Sleep(x*1000)
#else
#include <unistd.h>
#endif
#ifdef __APPLE__
#include <QProxyStyle>
#include <QProxyStyle>
class MyProxyStyle : public QProxyStyle
{
@@ -62,11 +57,14 @@ int main(int argc, char *argv[])
#endif
QApplication app(argc, argv);
app.setApplicationName("OpenTX Companion");
app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org");
app.setApplicationName(APP_COMPANION);
app.setOrganizationName(COMPANY);
app.setOrganizationDomain(COMPANY_DOMAIN);
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
if (AppDebugMessageHandler::instance())
AppDebugMessageHandler::instance()->installAppMessageHandler();
g.init();
QStringList strl = QApplication::arguments();
@@ -101,7 +99,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "ERROR: couldn't initialize SDL: %s\n", SDL_GetError());
}
#endif
registerStorageFactories();
registerOpenTxFirmwares();
registerSimulators();
@@ -142,5 +140,6 @@ int main(int argc, char *argv[])
SDL_Quit();
#endif
qDebug() << "COMPANION EXIT" << result;
return result;
}