1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-1245 Added buttons and combobox to the logging settings panel.

This commit is contained in:
m_thread 2014-03-08 13:47:41 +01:00
parent 4f6d680810
commit cbe4eea01e
4 changed files with 85 additions and 5 deletions

View File

@ -175,7 +175,21 @@ Rectangle {
anchors.fill: parent
Text {
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 {
@ -246,6 +260,39 @@ Rectangle {
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 {
id: settingsButton
enabled: !logManager.disableControls
text: qsTr("Log settings...")
text: qsTr("Settings...")
activeFocusOnPress: true
property bool showSettings: false
onClicked: {
showSettings = !showSettings;
settingsTab.visible = showSettings;
exportTab.visible = !showSettings;
text = (showSettings ? qsTr("View logs...") : qsTr("Log settings..."));
text = (showSettings ? qsTr("Logs...") : qsTr("Settings..."));
}
}
Rectangle {

View File

@ -51,6 +51,8 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan
QQuickView *view = new QQuickView();
view->rootContext()->setContextProperty("dialog", this);
view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus());
view->rootContext()->setContextProperty("logControl", flightLogManager->flightLogControl());
view->rootContext()->setContextProperty("logSettings", flightLogManager->flightLogSettings());
view->rootContext()->setContextProperty("logManager", flightLogManager);
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml"));

View File

@ -65,11 +65,14 @@ FlightLogManager::FlightLogManager(QObject *parent) :
m_flightLogEntry = DebugLogEntry::GetInstance(m_objectManager);
Q_ASSERT(m_flightLogEntry);
m_flightLogSettings = DebugLogSettings::GetInstance(m_objectManager);
Q_ASSERT(m_flightLogSettings);
updateFlightEntries(m_flightLogStatus->getFlight());
setupUAVOWrappers();
setupLogSettings();
setupLogStatuses();
}
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");
}
void FlightLogManager::setupLogStatuses()
{
m_logStatuses << tr("Never") << tr("Only when Armed") << tr("Always");
}
void FlightLogManager::connectionStatusChanged()
{
if (m_telemtryManager->isConnected()) {

View File

@ -38,6 +38,7 @@
#include "uavobjectmanager.h"
#include "debuglogentry.h"
#include "debuglogstatus.h"
#include "debuglogsettings.h"
#include "debuglogcontrol.h"
#include "uavtalk/telemetrymanager.h"
@ -116,6 +117,8 @@ private:
class FlightLogManager : public QObject {
Q_OBJECT
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(QStringList flightEntries READ flightEntries NOTIFY flightEntriesChanged)
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(QStringList logSettings READ logSettings NOTIFY logSettingsChanged)
Q_PROPERTY(QStringList logStatuses READ logStatuses NOTIFY logStatusesChanged)
public:
@ -167,6 +171,21 @@ public:
return m_boardConnected;
}
QStringList logStatuses() const
{
return m_logStatuses;
}
DebugLogControl * flightLogControl() const
{
return m_flightLogControl;
}
DebugLogSettings * flightLogSettings() const
{
return m_flightLogSettings;
}
signals:
void logEntriesChanged();
void flightEntriesChanged();
@ -177,6 +196,8 @@ signals:
void adjustExportedTimestampsChanged(bool arg);
void boardConnectedChanged(bool arg);
void logStatusesChanged(QStringList arg);
public slots:
void clearAllLogs();
void retrieveLogs(int flightToRetrieve = -1);
@ -219,6 +240,7 @@ private slots:
void updateFlightEntries(quint16 currentFlight);
void setupUAVOWrappers();
void setupLogSettings();
void setupLogStatuses();
void connectionStatusChanged();
private:
@ -227,10 +249,12 @@ private:
DebugLogControl *m_flightLogControl;
DebugLogStatus *m_flightLogStatus;
DebugLogEntry *m_flightLogEntry;
DebugLogSettings * m_flightLogSettings;
QList<ExtendedDebugLogEntry *> m_logEntries;
QStringList m_flightEntries;
QStringList m_logSettings;
QStringList m_logStatuses;
QList<UAVOLogSettingsWrapper *> m_uavoEntries;
@ -244,7 +268,6 @@ private:
bool m_cancelDownload;
bool m_adjustExportedTimestamps;
bool m_boardConnected;
};
#endif // FLIGHTLOGMANAGER_H