-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathConsole.cpp
More file actions
31 lines (25 loc) · 1022 Bytes
/
Console.cpp
File metadata and controls
31 lines (25 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/#include "Console.h" // <-- ADD THIS
#include <QSettings> // <-- ADD THIS
#include "applicationui.hpp"
#include <bb/cascades/Application>
#include <QLocale>
#include <QTranslator>
#include <Qt/qdeclarativedebug.h>
using namespace bb::cascades;
void myMessageOutput(QtMsgType type, const char* msg) { // <-- ADD THIS
Q_UNUSED(type); // <-- ADD THIS
fprintf(stdout, "%s\n", msg); // <-- ADD THIS
fflush(stdout); // <-- ADD THIS
QSettings settings; // <-- ADD THIS
if (settings.value("sendToConsoleDebug", true).toBool()) { // <-- ADD THIS -- Put this value to false if you want to stop sending logs to ConsoleDebug
Console* console = new Console(); // <-- ADD THIS
console->sendMessage("ConsoleThis$$" + QString(msg)); // <-- ADD THIS
console->deleteLater(); // <-- ADD THIS
} // <-- ADD THIS
} // <-- ADD THIS
Q_DECL_EXPORT int main(int argc, char **argv)
{
Application app(argc, argv);
qInstallMsgHandler(myMessageOutput); // <-- ADD THIS
...
}