fixed fallback step-logger
moved vap-grouping to settings-file sanity-checks
This commit is contained in:
@@ -6,10 +6,15 @@
|
||||
#include "../nav/NavControllerListener.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QPushButton>
|
||||
#include <QWindow>
|
||||
#include <QMainWindow>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include <Indoor/data/Timestamp.h>
|
||||
|
||||
/**
|
||||
* helper class to connect our NavigationController with the StepLogger
|
||||
@@ -21,13 +26,17 @@ private:
|
||||
/** convert from our position-format to ipin position-format */
|
||||
IPINScaler& scaler;
|
||||
|
||||
QMainWindow* window;
|
||||
QPushButton* btn;
|
||||
QWidget* widget = nullptr;
|
||||
QPushButton* btn = nullptr;
|
||||
QLabel* lblInfo = nullptr;
|
||||
QWidget* parent;// = nullptr;
|
||||
int cnt = 0;
|
||||
Timestamp lastEstTS;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
StepLoggerWrapper(IPINScaler& scaler) : scaler(scaler) {
|
||||
StepLoggerWrapper(IPINScaler& scaler, QWidget* parent) : scaler(scaler), parent(parent) {
|
||||
setupUI();
|
||||
}
|
||||
|
||||
@@ -44,6 +53,12 @@ public:
|
||||
// inform the logger
|
||||
StepLogger::onNewEstimation(ipin.lat, ipin.lon, ipin.floorNr);
|
||||
|
||||
++cnt;
|
||||
const Timestamp curTS = Timestamp::fromUnixTime();
|
||||
const Timestamp diff = curTS - lastEstTS;
|
||||
lastEstTS = curTS;
|
||||
lblInfo->setText("Est: " + QString::number(cnt) + " time: " + QString::number(diff.ms()));
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -51,23 +66,43 @@ private:
|
||||
/** create a clickable check button */
|
||||
void setupUI() {
|
||||
|
||||
window = new QMainWindow();
|
||||
//window->setTitle("StepLogger");
|
||||
btn = new QPushButton(window);
|
||||
|
||||
// almost fullscreen
|
||||
QRect geom = QDesktopWidget().availableGeometry();
|
||||
const int w = geom.width() * 0.9;
|
||||
const int h = geom.height() * 0.6;
|
||||
const int w = std::min(geom.width(), geom.height()) * 0.4;
|
||||
const int h = w;
|
||||
|
||||
/*
|
||||
window = new QDialog();
|
||||
|
||||
// center and set always-on-top
|
||||
window->setGeometry(geom.width()/2 - w/2, geom.height()/2 - h/2, w, h);
|
||||
window->setGeometry(geom.width()*0.7 - w/2, geom.height()*0.7 - h/2, w, h);
|
||||
const Qt::WindowFlags flags = window->windowFlags();
|
||||
window->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||
|
||||
|
||||
btn = new QPushButton(window);
|
||||
btn->setGeometry(5,5,w-5-5,h-5-5);
|
||||
window->show();
|
||||
*/
|
||||
|
||||
|
||||
widget = new QWidget(parent);
|
||||
widget->setGeometry(geom.width() - w - 5, geom.height()*0.85 - h, w, h);
|
||||
widget->setWindowFlags(widget->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||
widget->setVisible(true);
|
||||
|
||||
QGridLayout* lay = new QGridLayout(widget);
|
||||
|
||||
btn = new QPushButton();
|
||||
btn->setMinimumSize(w-10, h*0.8);
|
||||
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
btn->setWindowFlags(btn->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||
|
||||
lay->addWidget(btn, 0, 0, 1, 1);
|
||||
|
||||
lblInfo = new QLabel();
|
||||
lblInfo->setMinimumHeight(32); lblInfo->setMaximumHeight(32);
|
||||
lblInfo->setText("123");
|
||||
lay->addWidget(lblInfo, 1, 0, 1, 1);
|
||||
|
||||
// button clicked -> next waypoint
|
||||
btn->connect(btn, &QPushButton::clicked, [&] () {
|
||||
@@ -78,6 +113,11 @@ private:
|
||||
// show the current waypoint
|
||||
updateButton();
|
||||
|
||||
// //window->exec();
|
||||
// window->setFocusPolicy(Qt::StrongFocus);
|
||||
// window->setAttribute(Qt::WA_AcceptTouchEvents, true);
|
||||
// window->show();
|
||||
|
||||
}
|
||||
|
||||
/** update the current button label */
|
||||
|
||||
Reference in New Issue
Block a user