Commit 7e543bb0 authored by Gus Grubba's avatar Gus Grubba

Add a button to clear feature responses

More clang warnings cleanup
parent b66447ff
...@@ -597,7 +597,7 @@ adv_sort(QObject* a, QObject* b) ...@@ -597,7 +597,7 @@ adv_sort(QObject* a, QObject* b)
AirMapAdvisory* aa = qobject_cast<AirMapAdvisory*>(a); AirMapAdvisory* aa = qobject_cast<AirMapAdvisory*>(a);
AirMapAdvisory* bb = qobject_cast<AirMapAdvisory*>(b); AirMapAdvisory* bb = qobject_cast<AirMapAdvisory*>(b);
if(!aa || !bb) return false; if(!aa || !bb) return false;
return (int)aa->color() > (int)bb->color(); return static_cast<int>(aa->color()) > static_cast<int>(bb->color());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -607,7 +607,7 @@ rules_sort(QObject* a, QObject* b) ...@@ -607,7 +607,7 @@ rules_sort(QObject* a, QObject* b)
AirMapRule* aa = qobject_cast<AirMapRule*>(a); AirMapRule* aa = qobject_cast<AirMapRule*>(a);
AirMapRule* bb = qobject_cast<AirMapRule*>(b); AirMapRule* bb = qobject_cast<AirMapRule*>(b);
if(!aa || !bb) return false; if(!aa || !bb) return false;
return (int)aa->status() > (int)bb->status(); return static_cast<int>(aa->status()) > static_cast<int>(bb->status());
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -627,7 +627,7 @@ AirMapFlightPlanManager::_findBriefFeature(const QString& name) ...@@ -627,7 +627,7 @@ AirMapFlightPlanManager::_findBriefFeature(const QString& name)
void void
AirMapFlightPlanManager::_pollBriefing() AirMapFlightPlanManager::_pollBriefing()
{ {
qCDebug(AirMapManagerLog) << "Poll Briefing. State:" << (int)_state; qCDebug(AirMapManagerLog) << "Poll Briefing. State:" << static_cast<int>(_state);
if(_state != State::Idle) { if(_state != State::Idle) {
QTimer::singleShot(100, this, &AirMapFlightPlanManager::_pollBriefing); QTimer::singleShot(100, this, &AirMapFlightPlanManager::_pollBriefing);
return; return;
...@@ -721,7 +721,7 @@ AirMapFlightPlanManager::_pollBriefing() ...@@ -721,7 +721,7 @@ AirMapFlightPlanManager::_pollBriefing()
for (const auto& authorization : briefing.evaluation.authorizations) { for (const auto& authorization : briefing.evaluation.authorizations) {
AirMapFlightAuthorization* pAuth = new AirMapFlightAuthorization(authorization, this); AirMapFlightAuthorization* pAuth = new AirMapFlightAuthorization(authorization, this);
_authorizations.append(pAuth); _authorizations.append(pAuth);
qCDebug(AirMapManagerLog) << "Autorization:" << pAuth->name() << " (" << pAuth->message() << ")" << (int)pAuth->status(); qCDebug(AirMapManagerLog) << "Autorization:" << pAuth->name() << " (" << pAuth->message() << ")" << static_cast<int>(pAuth->status());
switch (authorization.status) { switch (authorization.status) {
case Evaluation::Authorization::Status::accepted: case Evaluation::Authorization::Status::accepted:
case Evaluation::Authorization::Status::accepted_upon_submission: case Evaluation::Authorization::Status::accepted_upon_submission:
...@@ -840,7 +840,7 @@ AirMapFlightPlanManager::loadFlightList(QDateTime startTime, QDateTime endTime) ...@@ -840,7 +840,7 @@ AirMapFlightPlanManager::loadFlightList(QDateTime startTime, QDateTime endTime)
void void
AirMapFlightPlanManager::_loadFlightList() AirMapFlightPlanManager::_loadFlightList()
{ {
qCDebug(AirMapManagerLog) << "Load flight list. State:" << (int)_state; qCDebug(AirMapManagerLog) << "Load flight list. State:" << static_cast<int>(_state);
if(_state != State::Idle) { if(_state != State::Idle) {
QTimer::singleShot(100, this, &AirMapFlightPlanManager::_loadFlightList); QTimer::singleShot(100, this, &AirMapFlightPlanManager::_loadFlightList);
return; return;
...@@ -854,10 +854,10 @@ AirMapFlightPlanManager::_loadFlightList() ...@@ -854,10 +854,10 @@ AirMapFlightPlanManager::_loadFlightList()
if (_state != State::LoadFlightList) return; if (_state != State::LoadFlightList) return;
Flights::Search::Parameters params; Flights::Search::Parameters params;
params.authorization = login_token.toStdString(); params.authorization = login_token.toStdString();
quint64 start = _rangeStart.toUTC().toMSecsSinceEpoch(); quint64 start = static_cast<quint64>(_rangeStart.toUTC().toMSecsSinceEpoch());
quint64 end = _rangeEnd.toUTC().toMSecsSinceEpoch(); quint64 end = static_cast<quint64>(_rangeEnd.toUTC().toMSecsSinceEpoch());
params.start_after = airmap::from_milliseconds_since_epoch(airmap::milliseconds((long long)start)); params.start_after = airmap::from_milliseconds_since_epoch(airmap::milliseconds(static_cast<long long>(start)));
params.start_before = airmap::from_milliseconds_since_epoch(airmap::milliseconds((long long)end)); params.start_before = airmap::from_milliseconds_since_epoch(airmap::milliseconds(static_cast<long long>(end)));
params.limit = 250; params.limit = 250;
params.pilot_id = _pilotID.toStdString(); params.pilot_id = _pilotID.toStdString();
_shared.client()->flights().search(params, [this, isAlive](const Flights::Search::Result& result) { _shared.client()->flights().search(params, [this, isAlive](const Flights::Search::Result& result) {
......
...@@ -42,9 +42,9 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox) ...@@ -42,9 +42,9 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{ {
_logger = std::make_shared<qt::Logger>(); _logger = std::make_shared<qt::Logger>();
qt::register_types(); // TODO: still needed? qt::register_types(); // TODO: still needed?
_logger->logging_category().setEnabled(QtDebugMsg, false); _logger->logging_category().setEnabled(QtDebugMsg, true);
_logger->logging_category().setEnabled(QtInfoMsg, false); _logger->logging_category().setEnabled(QtInfoMsg, true);
_logger->logging_category().setEnabled(QtWarningMsg, false); _logger->logging_category().setEnabled(QtWarningMsg, true);
_dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger); _dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger);
connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error); connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error);
} }
......
...@@ -75,15 +75,17 @@ QGCView { ...@@ -75,15 +75,17 @@ QGCView {
} }
} }
Rectangle { Rectangle {
height: generalCol.height + (ScreenTools.defaultFontPixelHeight * 2) height: generalRow.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _panelWidth width: _panelWidth
color: qgcPal.windowShade color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Row {
id: generalRow
spacing: ScreenTools.defaultFontPixelWidth * 4
anchors.centerIn: parent
Column { Column {
id: generalCol
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
FactCheckBox { FactCheckBox {
text: qsTr("Enable AirMap Services") text: qsTr("Enable AirMap Services")
fact: _enableAirMapFact fact: _enableAirMapFact
...@@ -97,6 +99,28 @@ QGCView { ...@@ -97,6 +99,28 @@ QGCView {
property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry
} }
} }
QGCButton {
text: qsTr("Reset AirMap Data")
enabled: _enableAirMapFact.rawValue
onClicked: clearDialog.open()
anchors.verticalCenter: parent.verticalCenter
MessageDialog {
id: clearDialog
visible: false
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
title: qsTr("Reset AirMap Data")
text: qsTr("All saved ruleset answers will be cleared. Is this really what you want?")
onYes: {
QGroundControl.airspaceManager.ruleSets.clearAllFeatures()
clearDialog.close()
}
onNo: {
clearDialog.close()
}
}
}
}
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
//-- Connection Status //-- Connection Status
......
...@@ -60,7 +60,7 @@ Rectangle { ...@@ -60,7 +60,7 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: { Component.onCompleted: {
checked = feature.value && feature.value < 2 ? feature.value : false checked = feature.value === 2 ? false : feature.value
} }
} }
QGCLabel { QGCLabel {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment