diff --git a/src/Camera/QGCCameraIO.cc b/src/Camera/QGCCameraIO.cc index a8d4130..11f4876 100644 --- a/src/Camera/QGCCameraIO.cc +++ b/src/Camera/QGCCameraIO.cc @@ -76,7 +76,7 @@ QGCCameraParamIO::QGCCameraParamIO(QGCCameraControl *control, Fact* fact, Vehicl break; default: qWarning() << "Unsupported fact type" << _fact->type() << "for" << _fact->name(); - // Fall through + //-- Fall Through (screw clang) case FactMetaData::valueTypeInt32: _mavParamType = MAV_PARAM_EXT_TYPE_INT32; break; @@ -140,25 +140,25 @@ QGCCameraParamIO::_sendParameter() switch (factType) { case FactMetaData::valueTypeUint8: case FactMetaData::valueTypeBool: - union_value.param_uint8 = (uint8_t)_fact->rawValue().toUInt(); + union_value.param_uint8 = static_cast(_fact->rawValue().toUInt()); break; case FactMetaData::valueTypeInt8: - union_value.param_int8 = (int8_t)_fact->rawValue().toInt(); + union_value.param_int8 = static_cast(_fact->rawValue().toInt()); break; case FactMetaData::valueTypeUint16: - union_value.param_uint16 = (uint16_t)_fact->rawValue().toUInt(); + union_value.param_uint16 = static_cast(_fact->rawValue().toUInt()); break; case FactMetaData::valueTypeInt16: - union_value.param_int16 = (int16_t)_fact->rawValue().toInt(); + union_value.param_int16 = static_cast(_fact->rawValue().toInt()); break; case FactMetaData::valueTypeUint32: - union_value.param_uint32 = (uint32_t)_fact->rawValue().toUInt(); + union_value.param_uint32 = static_cast(_fact->rawValue().toUInt()); break; case FactMetaData::valueTypeInt64: - union_value.param_int64 = (int64_t)_fact->rawValue().toLongLong(); + union_value.param_int64 = static_cast(_fact->rawValue().toLongLong()); break; case FactMetaData::valueTypeUint64: - union_value.param_uint64 = (uint64_t)_fact->rawValue().toULongLong(); + union_value.param_uint64 = static_cast(_fact->rawValue().toULongLong()); break; case FactMetaData::valueTypeFloat: union_value.param_float = _fact->rawValue().toFloat(); @@ -171,23 +171,23 @@ QGCCameraParamIO::_sendParameter() case FactMetaData::valueTypeCustom: { QByteArray custom = _fact->rawValue().toByteArray(); - memcpy(union_value.bytes, custom.data(), std::max(custom.size(), MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_VALUE_LEN)); + memcpy(union_value.bytes, custom.data(), static_cast(std::max(custom.size(), MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_VALUE_LEN))); } break; default: qCritical() << "Unsupported fact type" << factType << "for" << _fact->name(); - // fall through + //-- Fall Through (screw clang) case FactMetaData::valueTypeInt32: - union_value.param_int32 = (int32_t)_fact->rawValue().toInt(); + union_value.param_int32 = static_cast(_fact->rawValue().toInt()); break; } memcpy(&p.param_value[0], &union_value.bytes[0], MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_VALUE_LEN); - p.target_system = (uint8_t)_vehicle->id(); - p.target_component = (uint8_t)_control->compID(); + p.target_system = static_cast(_vehicle->id()); + p.target_component = static_cast(_control->compID()); strncpy(p.param_id, _fact->name().toStdString().c_str(), MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_ID_LEN); mavlink_msg_param_ext_set_encode_chan( - _pMavlink->getSystemId(), - _pMavlink->getComponentId(), + static_cast(_pMavlink->getSystemId()), + static_cast(_pMavlink->getComponentId()), _vehicle->priorityLink()->mavlinkChannel(), &msg, &p); @@ -301,10 +301,10 @@ QGCCameraParamIO::_valueFromMessage(const char* value, uint8_t param_type) var = QVariant(u.param_int32); break; case MAV_PARAM_EXT_TYPE_UINT64: - var = QVariant((qulonglong)u.param_uint64); + var = QVariant(static_cast(u.param_uint64)); break; case MAV_PARAM_EXT_TYPE_INT64: - var = QVariant((qlonglong)u.param_int64); + var = QVariant(static_cast(u.param_int64)); break; case MAV_PARAM_EXT_TYPE_CUSTOM: var = QVariant(QByteArray(value, MAVLINK_MSG_PARAM_EXT_SET_FIELD_PARAM_VALUE_LEN)); @@ -356,12 +356,12 @@ QGCCameraParamIO::paramRequest(bool reset) strncpy(param_id, _fact->name().toStdString().c_str(), MAVLINK_MSG_PARAM_EXT_REQUEST_READ_FIELD_PARAM_ID_LEN); mavlink_message_t msg; mavlink_msg_param_ext_request_read_pack_chan( - _pMavlink->getSystemId(), - _pMavlink->getComponentId(), + static_cast(_pMavlink->getSystemId()), + static_cast(_pMavlink->getComponentId()), _vehicle->priorityLink()->mavlinkChannel(), &msg, - _vehicle->id(), - _control->compID(), + static_cast(_vehicle->id()), + static_cast(_control->compID()), param_id, -1); _vehicle->sendMessageOnLink(_vehicle->priorityLink(), msg); diff --git a/src/FlightDisplay/VideoManager.cc b/src/FlightDisplay/VideoManager.cc index bdb10e2..f825927 100644 --- a/src/FlightDisplay/VideoManager.cc +++ b/src/FlightDisplay/VideoManager.cc @@ -291,14 +291,20 @@ VideoManager::_updateSettings() qCDebug(VideoManagerLog) << "Configure primary stream: " << pInfo->uri(); switch(pInfo->type()) { case VIDEO_STREAM_TYPE_RTSP: + _videoReceiver->setUri(pInfo->uri()); + _toolbox->settingsManager()->videoSettings()->videoSource()->setRawValue(VideoSettings::videoSourceRTSP); + break; case VIDEO_STREAM_TYPE_TCP_MPEG: _videoReceiver->setUri(pInfo->uri()); + _toolbox->settingsManager()->videoSettings()->videoSource()->setRawValue(VideoSettings::videoSourceTCP); break; case VIDEO_STREAM_TYPE_RTPUDP: _videoReceiver->setUri(QStringLiteral("udp://0.0.0.0:%1").arg(pInfo->uri())); + _toolbox->settingsManager()->videoSettings()->videoSource()->setRawValue(VideoSettings::videoSourceUDPH264); break; case VIDEO_STREAM_TYPE_MPEG_TS_H264: _videoReceiver->setUri(QStringLiteral("mpegts://0.0.0.0:%1").arg(pInfo->uri())); + _toolbox->settingsManager()->videoSettings()->videoSource()->setRawValue(VideoSettings::videoSourceMPEGTS); break; default: _videoReceiver->setUri(pInfo->uri()); diff --git a/src/QGCApplication.h b/src/QGCApplication.h index 7b93c54..c48edcb 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -79,7 +79,7 @@ public: void showMessage(const QString& message); /// @return true: Fake ui into showing mobile interface - bool fakeMobile(void) { return _fakeMobile; } + bool fakeMobile(void) const { return _fakeMobile; } // Still working on getting rid of this and using dependency injection instead for everything QGCToolbox* toolbox(void) { return _toolbox; } diff --git a/src/QmlControls/ScreenToolsController.cc b/src/QmlControls/ScreenToolsController.cc index 6a219e1..408f967 100644 --- a/src/QmlControls/ScreenToolsController.cc +++ b/src/QmlControls/ScreenToolsController.cc @@ -26,6 +26,12 @@ ScreenToolsController::ScreenToolsController() } +bool +ScreenToolsController::hasTouch() const +{ + return QTouchDevice::devices().count() > 0 || isMobile(); +} + QString ScreenToolsController::iOSDevice() const { diff --git a/src/QmlControls/ScreenToolsController.h b/src/QmlControls/ScreenToolsController.h index cb66587..71f5788 100644 --- a/src/QmlControls/ScreenToolsController.h +++ b/src/QmlControls/ScreenToolsController.h @@ -37,6 +37,7 @@ public: Q_PROPERTY(bool isLinux READ isLinux CONSTANT) Q_PROPERTY(bool isWindows READ isWindows CONSTANT) Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT) + Q_PROPERTY(bool hasTouch READ hasTouch CONSTANT) Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT) Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT) Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT) @@ -47,9 +48,9 @@ public: Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); } #if defined(__mobile__) - bool isMobile () { return true; } + bool isMobile () const { return true; } #else - bool isMobile () { return qgcApp()->fakeMobile(); } + bool isMobile () const { return qgcApp()->fakeMobile(); } #endif #if defined (Q_OS_ANDROID) @@ -102,6 +103,8 @@ public: bool isDebug () { return false; } #endif + bool hasTouch() const; + QString iOSDevice () const; QString fixedFontFamily () const; QString normalFontFamily () const; diff --git a/src/ui/MainRootWindow.qml b/src/ui/MainRootWindow.qml index a1d64e7..7c25295 100644 --- a/src/ui/MainRootWindow.qml +++ b/src/ui/MainRootWindow.qml @@ -147,6 +147,10 @@ ApplicationWindow { mainWindowDialog.dialogTitle = title mainWindowDialog.dialogButtons = buttons mainWindowDialog.open() + if(buttons & StandardButton.Cancel || buttons & StandardButton.Close || buttons & StandardButton.Discard || buttons & StandardButton.Abort || buttons & StandardButton.Ignore) { + mainWindowDialog.closePolicy = Popup.CloseOnEscape | Popup.CloseOnPressOutside; + mainWindowDialog.interactive = true; + } } Drawer {