mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
OP-1245 Added buttons and combobox to the logging settings panel.
This commit is contained in:
parent
4f6d680810
commit
cbe4eea01e
@ -175,7 +175,21 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: "<b>" + qsTr("Log settings") + "</b>"
|
text: "<b>" + qsTr("Settings") + "</b>"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Text {
|
||||||
|
text: qsTr("When to log: ")
|
||||||
|
}
|
||||||
|
ComboBox {
|
||||||
|
enabled: !logManager.disableControls && logManager.boardConnected
|
||||||
|
model: logManager.logStatuses
|
||||||
|
currentIndex: logSettings.getLoggingEnabled()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@ -246,6 +260,39 @@ Rectangle {
|
|||||||
delegate: comboEditableDelegate
|
delegate: comboEditableDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Button {
|
||||||
|
enabled: !logManager.disableControls && logManager.boardConnected
|
||||||
|
text: qsTr("Load...")
|
||||||
|
activeFocusOnPress: true
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
enabled: !logManager.disableControls && logManager.boardConnected
|
||||||
|
text: qsTr("Save...")
|
||||||
|
activeFocusOnPress: true
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
enabled: !logManager.disableControls && logManager.boardConnected
|
||||||
|
text: qsTr("Reset")
|
||||||
|
activeFocusOnPress: true
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
enabled: !logManager.disableControls && logManager.boardConnected
|
||||||
|
text: qsTr("Apply to board")
|
||||||
|
activeFocusOnPress: true
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
enabled: !logManager.disableControls && logManager.boardConnected
|
||||||
|
text: qsTr("Save to board")
|
||||||
|
activeFocusOnPress: true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,14 +302,14 @@ Rectangle {
|
|||||||
Button {
|
Button {
|
||||||
id: settingsButton
|
id: settingsButton
|
||||||
enabled: !logManager.disableControls
|
enabled: !logManager.disableControls
|
||||||
text: qsTr("Log settings...")
|
text: qsTr("Settings...")
|
||||||
activeFocusOnPress: true
|
activeFocusOnPress: true
|
||||||
property bool showSettings: false
|
property bool showSettings: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showSettings = !showSettings;
|
showSettings = !showSettings;
|
||||||
settingsTab.visible = showSettings;
|
settingsTab.visible = showSettings;
|
||||||
exportTab.visible = !showSettings;
|
exportTab.visible = !showSettings;
|
||||||
text = (showSettings ? qsTr("View logs...") : qsTr("Log settings..."));
|
text = (showSettings ? qsTr("Logs...") : qsTr("Settings..."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -51,6 +51,8 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan
|
|||||||
QQuickView *view = new QQuickView();
|
QQuickView *view = new QQuickView();
|
||||||
view->rootContext()->setContextProperty("dialog", this);
|
view->rootContext()->setContextProperty("dialog", this);
|
||||||
view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus());
|
view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus());
|
||||||
|
view->rootContext()->setContextProperty("logControl", flightLogManager->flightLogControl());
|
||||||
|
view->rootContext()->setContextProperty("logSettings", flightLogManager->flightLogSettings());
|
||||||
view->rootContext()->setContextProperty("logManager", flightLogManager);
|
view->rootContext()->setContextProperty("logManager", flightLogManager);
|
||||||
view->setResizeMode(QQuickView::SizeRootObjectToView);
|
view->setResizeMode(QQuickView::SizeRootObjectToView);
|
||||||
view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml"));
|
view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml"));
|
||||||
|
@ -65,11 +65,14 @@ FlightLogManager::FlightLogManager(QObject *parent) :
|
|||||||
m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager);
|
m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager);
|
||||||
Q_ASSERT(m_flightLogEntry);
|
Q_ASSERT(m_flightLogEntry);
|
||||||
|
|
||||||
|
m_flightLogSettings = DebugLogSettings::GetInstance(m_objectManager);
|
||||||
|
Q_ASSERT(m_flightLogSettings);
|
||||||
|
|
||||||
updateFlightEntries(m_flightLogStatus->getFlight());
|
updateFlightEntries(m_flightLogStatus->getFlight());
|
||||||
|
|
||||||
setupUAVOWrappers();
|
setupUAVOWrappers();
|
||||||
|
|
||||||
setupLogSettings();
|
setupLogSettings();
|
||||||
|
setupLogStatuses();
|
||||||
}
|
}
|
||||||
|
|
||||||
FlightLogManager::~FlightLogManager()
|
FlightLogManager::~FlightLogManager()
|
||||||
@ -409,6 +412,11 @@ void FlightLogManager::setupLogSettings()
|
|||||||
<< tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute");
|
<< tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlightLogManager::setupLogStatuses()
|
||||||
|
{
|
||||||
|
m_logStatuses << tr("Never") << tr("Only when Armed") << tr("Always");
|
||||||
|
}
|
||||||
|
|
||||||
void FlightLogManager::connectionStatusChanged()
|
void FlightLogManager::connectionStatusChanged()
|
||||||
{
|
{
|
||||||
if (m_telemtryManager->isConnected()) {
|
if (m_telemtryManager->isConnected()) {
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
#include "debuglogentry.h"
|
#include "debuglogentry.h"
|
||||||
#include "debuglogstatus.h"
|
#include "debuglogstatus.h"
|
||||||
|
#include "debuglogsettings.h"
|
||||||
#include "debuglogcontrol.h"
|
#include "debuglogcontrol.h"
|
||||||
#include "uavtalk/telemetrymanager.h"
|
#include "uavtalk/telemetrymanager.h"
|
||||||
|
|
||||||
@ -116,6 +117,8 @@ private:
|
|||||||
class FlightLogManager : public QObject {
|
class FlightLogManager : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus)
|
Q_PROPERTY(DebugLogStatus *flightLogStatus READ flightLogStatus)
|
||||||
|
Q_PROPERTY(DebugLogControl *flightLogControl READ flightLogControl)
|
||||||
|
Q_PROPERTY(DebugLogSettings *flightLogSettings READ flightLogSettings)
|
||||||
Q_PROPERTY(QQmlListProperty<ExtendedDebugLogEntry> logEntries READ logEntries NOTIFY logEntriesChanged)
|
Q_PROPERTY(QQmlListProperty<ExtendedDebugLogEntry> logEntries READ logEntries NOTIFY logEntriesChanged)
|
||||||
Q_PROPERTY(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged)
|
Q_PROPERTY(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged)
|
||||||
Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged)
|
Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged)
|
||||||
@ -125,6 +128,7 @@ class FlightLogManager : public QObject {
|
|||||||
|
|
||||||
Q_PROPERTY(QQmlListProperty<UAVOLogSettingsWrapper> uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged)
|
Q_PROPERTY(QQmlListProperty<UAVOLogSettingsWrapper> uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged)
|
||||||
Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged)
|
Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged)
|
||||||
|
Q_PROPERTY(QStringList logStatuses READ logStatuses NOTIFY logStatusesChanged)
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -167,6 +171,21 @@ public:
|
|||||||
return m_boardConnected;
|
return m_boardConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList logStatuses() const
|
||||||
|
{
|
||||||
|
return m_logStatuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugLogControl * flightLogControl() const
|
||||||
|
{
|
||||||
|
return m_flightLogControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugLogSettings * flightLogSettings() const
|
||||||
|
{
|
||||||
|
return m_flightLogSettings;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void logEntriesChanged();
|
void logEntriesChanged();
|
||||||
void flightEntriesChanged();
|
void flightEntriesChanged();
|
||||||
@ -177,6 +196,8 @@ signals:
|
|||||||
void adjustExportedTimestampsChanged(bool arg);
|
void adjustExportedTimestampsChanged(bool arg);
|
||||||
void boardConnectedChanged(bool arg);
|
void boardConnectedChanged(bool arg);
|
||||||
|
|
||||||
|
void logStatusesChanged(QStringList arg);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clearAllLogs();
|
void clearAllLogs();
|
||||||
void retrieveLogs(int flightToRetrieve = -1);
|
void retrieveLogs(int flightToRetrieve = -1);
|
||||||
@ -219,6 +240,7 @@ private slots:
|
|||||||
void updateFlightEntries(quint16 currentFlight);
|
void updateFlightEntries(quint16 currentFlight);
|
||||||
void setupUAVOWrappers();
|
void setupUAVOWrappers();
|
||||||
void setupLogSettings();
|
void setupLogSettings();
|
||||||
|
void setupLogStatuses();
|
||||||
void connectionStatusChanged();
|
void connectionStatusChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -227,10 +249,12 @@ private:
|
|||||||
DebugLogControl *m_flightLogControl;
|
DebugLogControl *m_flightLogControl;
|
||||||
DebugLogStatus *m_flightLogStatus;
|
DebugLogStatus *m_flightLogStatus;
|
||||||
DebugLogEntry *m_flightLogEntry;
|
DebugLogEntry *m_flightLogEntry;
|
||||||
|
DebugLogSettings * m_flightLogSettings;
|
||||||
|
|
||||||
QList<ExtendedDebugLogEntry *> m_logEntries;
|
QList<ExtendedDebugLogEntry *> m_logEntries;
|
||||||
QStringList m_flightEntries;
|
QStringList m_flightEntries;
|
||||||
QStringList m_logSettings;
|
QStringList m_logSettings;
|
||||||
|
QStringList m_logStatuses;
|
||||||
|
|
||||||
QList<UAVOLogSettingsWrapper *> m_uavoEntries;
|
QList<UAVOLogSettingsWrapper *> m_uavoEntries;
|
||||||
|
|
||||||
@ -244,7 +268,6 @@ private:
|
|||||||
bool m_cancelDownload;
|
bool m_cancelDownload;
|
||||||
bool m_adjustExportedTimestamps;
|
bool m_adjustExportedTimestamps;
|
||||||
bool m_boardConnected;
|
bool m_boardConnected;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLIGHTLOGMANAGER_H
|
#endif // FLIGHTLOGMANAGER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user