diff --git a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml index 68f0aeb58..b5adb708e 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml +++ b/ground/openpilotgcs/src/plugins/flightlog/FlightLogDialog.qml @@ -176,7 +176,44 @@ Rectangle { Layout.fillWidth: true text: "" + qsTr("Log settings") + "" } + + Component { + id: comboEditableDelegate + Item { + + Text { + width: parent.width + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + elide: styleData.elideMode + text: styleData.value !== undefined ? logManager.logSettings[styleData.value] : "" + color: styleData.textColor + visible: !styleData.selected + } + Loader { + id: loaderEditor + anchors.fill: parent + Connections { + target: loaderEditor.item + onCurrentIndexChanged: { + logManager.uavoEntries[styleData.row].setting = loaderEditor.item.currentIndex + } + } + sourceComponent: styleData.selected ? editor : null + Component { + id: editor + ComboBox { + id: combo + model: logManager.logSettings + currentIndex: styleData.value + } + } + } + } + } + TableView { + id: settingsTable Layout.fillWidth: true Layout.fillHeight: true Layout.preferredHeight: 1000; @@ -204,15 +241,8 @@ Rectangle { role: "setting"; title: qsTr("Settings"); width: 200; - delegate: - ComboBox { - anchors.leftMargin: 5 - model: logManager.logSettings - currentIndex: styleData.value - //onCurrentIndexChanged: - } + delegate: comboEditableDelegate } - } } } diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp index dab94c474..d3b36029a 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogdialog.cpp @@ -42,8 +42,6 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan { qmlRegisterType("org.openpilot", 1, 0, "DebugLogEntry"); qmlRegisterType("org.openpilot", 1, 0, "UAVOLogSettingsWrapper"); - qmlRegisterUncreatableType("org.openpilot", 1, 0, "UAVObject", ""); - qRegisterMetaType("UAVOLogSettingsWrapper::UAVLogSetting"); setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png")); setWindowTitle(tr("Manage flight side logs")); diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp index 27ced5b10..a0b3152f6 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.cpp @@ -362,7 +362,7 @@ UAVOLogSettingsWrapper::UAVOLogSettingsWrapper() : QObject() {} UAVOLogSettingsWrapper::UAVOLogSettingsWrapper(UAVObject *object) : QObject(), - m_object(object), m_setting(EVERY_5S) + m_object(object), m_setting(DISABLED) {} UAVOLogSettingsWrapper::~UAVOLogSettingsWrapper() diff --git a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h index 826b9b5d1..dbe57c599 100644 --- a/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h +++ b/ground/openpilotgcs/src/plugins/flightlog/flightlogmanager.h @@ -40,9 +40,8 @@ class UAVOLogSettingsWrapper : public QObject { Q_OBJECT - Q_ENUMS(UAVLogSetting) Q_PROPERTY(QString name READ name NOTIFY nameChanged) - Q_PROPERTY(UAVOLogSettingsWrapper::UAVLogSetting setting READ setting WRITE setSetting NOTIFY settingChanged) + Q_PROPERTY(int setting READ setting WRITE setSetting NOTIFY settingChanged) public: enum UAVLogSetting {DISABLED = 0, ON_CHANGE, EVERY_10MS, EVERY_50MS, EVERY_100MS, @@ -57,27 +56,27 @@ public: return m_object->getName(); } - UAVOLogSettingsWrapper::UAVLogSetting setting() const + int setting() const { return m_setting; } public slots: - void setSetting(UAVOLogSettingsWrapper::UAVLogSetting arg) + void setSetting(int setting) { - if (m_setting != arg) { - m_setting = arg; - emit settingChanged(arg); + if (m_setting != (int)setting) { + m_setting = (int)setting; + emit settingChanged((int)setting); } } signals: - void settingChanged(UAVLogSetting arg); + void settingChanged(int setting); void nameChanged(); private: UAVObject *m_object; - UAVLogSetting m_setting; + int m_setting; }; class ExtendedDebugLogEntry : public DebugLogEntry { @@ -223,6 +222,4 @@ private: bool m_adjustExportedTimestamps; }; -Q_DECLARE_METATYPE(UAVOLogSettingsWrapper::UAVLogSetting) - #endif // FLIGHTLOGMANAGER_H