minor parameter changes more log lines added VAP log to UI (debug) fixed missing wifi timestamp for android live data
47 lines
982 B
C++
47 lines
982 B
C++
#ifndef LOGGERUI_H
|
|
#define LOGGERUI_H
|
|
|
|
#include <QApplication>
|
|
#include "debug/InfoWidget.h"
|
|
#include <Indoor/misc/log/Logger.h>
|
|
|
|
/** send all log-messages to the UI */
|
|
class LoggerUI : public Logger {
|
|
|
|
private:
|
|
|
|
InfoWidget* iw;
|
|
const int numLines = 5;
|
|
std::vector<QString> lines;
|
|
|
|
public:
|
|
|
|
/** ctor with the main-menu to show the log within */
|
|
LoggerUI(InfoWidget* iw) : iw(iw) {
|
|
lines.push_back("");
|
|
}
|
|
|
|
void add(const std::string& str, const bool nl) override {
|
|
lines.back() += QString(str.c_str());
|
|
if (nl) {lines.push_back("");}
|
|
while(lines.size() > numLines) {lines.erase(lines.begin());}
|
|
QString qs = getStr();
|
|
QMetaObject::invokeMethod(iw, "showLog", Qt::QueuedConnection, Q_ARG(const QString&, qs));
|
|
QApplication::processEvents();
|
|
//mm->showActivity(getStr());
|
|
}
|
|
|
|
private:
|
|
|
|
QString getStr() const {
|
|
QString str;
|
|
for (const QString& line : lines) {str += line + "\n";}
|
|
str.remove(str.length()-1, 1);
|
|
return str;
|
|
}
|
|
|
|
|
|
};
|
|
|
|
#endif // LOGGERUI_H
|