This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
YASMIN/ui/LoggerUI.h
kazu 5ddc455bee changed number of fingerprint scans
minor parameter changes
more log lines
added VAP log to UI (debug)
fixed missing wifi timestamp for android live data
2016-09-28 15:29:25 +02:00

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