From c4aaa11d86d419d1aa216beaaf7424c713b78c8e Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 3 Jan 2019 13:43:43 +0100 Subject: test app: Improve status and error handling a bit - Reset "running" check box if an error occurs - Add check box to manually reset position source's error code, as error is not emitted with NoError - There is no need to handle the "OK" case in errorChanged, as the corresponding signal will not be emitted for NoError Change-Id: I53d637c8efd807d6c3e8abff98963585fe74f220 Reviewed-by: Alex Blasche --- tests/applications/positioning_backend/widget.cpp | 13 ++++++++++--- tests/applications/positioning_backend/widget.h | 1 + tests/applications/positioning_backend/widget.ui | 23 +++++++++++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/applications/positioning_backend/widget.cpp b/tests/applications/positioning_backend/widget.cpp index efdaebdd..3244c478 100644 --- a/tests/applications/positioning_backend/widget.cpp +++ b/tests/applications/positioning_backend/widget.cpp @@ -102,7 +102,9 @@ void Widget::positionTimedOut() void Widget::errorChanged(QGeoPositionInfoSource::Error err) { - ui->labelErrorState->setText(err == 3 ? QStringLiteral("OK") : QString::number(err)); + ui->labelErrorState->setText(QString::number(err)); + m_posSource->stopUpdates(); + ui->checkBox->setChecked(false); } Widget::~Widget() @@ -126,11 +128,11 @@ void Widget::on_buttonStart_clicked() // Either start or stop the current position info source bool running = ui->checkBox->isChecked(); if (running) { - m_posSource->stopUpdates(); ui->checkBox->setChecked(false); + m_posSource->stopUpdates(); } else { - m_posSource->startUpdates(); ui->checkBox->setChecked(true); + m_posSource->startUpdates(); } } @@ -175,3 +177,8 @@ void Widget::on_buttonUpdateSupported_clicked() ui->labelSupported->setText(text); } + +void Widget::on_buttonResetError_clicked() +{ + ui->labelErrorState->setText(QStringLiteral("N/A")); +} diff --git a/tests/applications/positioning_backend/widget.h b/tests/applications/positioning_backend/widget.h index b67e53b8..e0dc68fc 100644 --- a/tests/applications/positioning_backend/widget.h +++ b/tests/applications/positioning_backend/widget.h @@ -59,6 +59,7 @@ private slots: void on_radioButton_4_clicked(); void on_buttonUpdateSupported_clicked(); + void on_buttonResetError_clicked(); private: LogWidget *log = nullptr; diff --git a/tests/applications/positioning_backend/widget.ui b/tests/applications/positioning_backend/widget.ui index a96a83f6..9cb1566d 100644 --- a/tests/applications/positioning_backend/widget.ui +++ b/tests/applications/positioning_backend/widget.ui @@ -135,11 +135,22 @@ - - - N/A - - + + + + + N/A + + + + + + + Reset + + + + @@ -199,7 +210,7 @@ 43 21 - 251 + 254 71 -- cgit v1.2.3