current revision

This commit is contained in:
2016-09-28 12:16:45 +02:00
parent 075d8bb633
commit d47322e73b
90 changed files with 8228 additions and 606 deletions

46
ui/LoggerUI.h Normal file
View File

@@ -0,0 +1,46 @@
#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;
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() > 4) {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