1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-1119 Changed from ListView to TableView. Starting to implement the log entry population and retrieveng code.

This commit is contained in:
m_thread 2013-11-21 18:07:48 +01:00
parent e693d94637
commit 077c2b0921
3 changed files with 65 additions and 76 deletions

View File

@ -13,96 +13,89 @@ Rectangle {
anchors.margins: 10 anchors.margins: 10
spacing: 10 spacing: 10
ScrollView { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
frameVisible: true border.width: 1
ListView { radius: 4
id: authorsView ColumnLayout {
anchors.margins: 10
anchors.fill: parent anchors.fill: parent
spacing: 3 Text {
model: logManager.logEntries Layout.fillWidth: true
delegate: Text { text: "<b>" + qsTr("Log entries") + "</b>"
font.pixelSize: 12 font.pixelSize: 12
text: Flight
} }
clip: true TableView {
} Layout.fillWidth: true
} Layout.fillHeight: true
model: logManager.logEntries
TableViewColumn { role: "Flight"; title: "Flight"; width: 50; horizontalAlignment: Text.AlignRight}
TableViewColumn { role: "FlightTime"; title: "Time";width: 50; horizontalAlignment: Text.AlignRight}
TableViewColumn { role: "Entry"; title: "#"; width: 50; horizontalAlignment: Text.AlignRight}
TableViewColumn { role: "Type"; title: "Contents"; width: 100}
}
RowLayout {
Layout.fillWidth: true
spacing: 10
ColumnLayout {
spacing: 10
height: 40
Text {
id: totalFlights
font.pixelSize: 12
text: "<b>" + qsTr("Flights recorded: ") + "</b>" + (logStatus.Flight + 1)
}
Text {
id: totalEntries
font.pixelSize: 12
text: "<b>" + qsTr("Logs slots used: ") + "</b>" + logStatus.UsedSlots
}
Text {
id: freeEntries
font.pixelSize: 12
text: "<b>" + qsTr("Logs slots left: ") + "</b>" + logStatus.FreeSlots
}
}
Rectangle {
Layout.fillWidth: true
}
ColumnLayout {
spacing: 10
height: 40
RowLayout { RowLayout {
anchors.margins: 10
spacing: 10
ColumnLayout {
spacing: 10
Text {
id: totalFlights
font.pixelSize: 12
text: "<b>" + qsTr("Flights recorded: ") + "</b>" + (logStatus.Flight + 1)
}
Text {
id: totalEntries
font.pixelSize: 12
text: "<b>" + qsTr("Entries logged (free): ") + "</b>" +
logStatus.UsedSlots + " (" + logStatus.FreeSlots + ")"
}
}
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
} }
Text { ColumnLayout {
font.pixelSize: 12 spacing: 10
text: "<b>" + qsTr("Flight to download:") + "</b>" RowLayout {
} Rectangle {
Layout.fillWidth: true
}
Text {
font.pixelSize: 12
text: "<b>" + qsTr("Flight to download:") + "</b>"
}
ComboBox { ComboBox {
id: flightCombo id: flightCombo
property ListModel dataModel: ListModel {} property ListModel dataModel: ListModel {}
model: dataModel model: dataModel
Component.onCompleted: { Component.onCompleted: {
dataModel.append({"value": "All"}) dataModel.append({"value": "All"})
for (var a = 0; a <= logStatus.Flight ; a++) { for (var a = 0; a <= logStatus.Flight ; a++) {
dataModel.append({"value": (a + 1).toString()}) dataModel.append({"value": (a + 1).toString()})
}
}
}
}
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Rectangle {
Layout.fillWidth: true
}
Button {
text: qsTr("Download logs")
activeFocusOnPress: true
onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
} }
} }
} }
} }
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Rectangle {
Layout.fillWidth: true
}
Button {
text: qsTr("Download logs")
activeFocusOnPress: true
onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
}
}
} }
} }
Rectangle {
border.width: 1
height: 2
width: parent.width
anchors.margins: 20
anchors.horizontalCenter: parent.horizontalCenter
border.color: "#adadad"
}
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
height: 40 height: 40

View File

@ -45,7 +45,6 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan
setWindowTitle(tr("Manage flight side logs")); setWindowTitle(tr("Manage flight side logs"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setMinimumSize(600, 400); setMinimumSize(600, 400);
setMaximumSize(800, 600);
QQuickView *view = new QQuickView(); QQuickView *view = new QQuickView();
view->rootContext()->setContextProperty("dialog", this); view->rootContext()->setContextProperty("dialog", this);
@ -56,7 +55,6 @@ FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogMan
QWidget * container = QWidget::createWindowContainer(view); QWidget * container = QWidget::createWindowContainer(view);
container->setMinimumSize(600, 400); container->setMinimumSize(600, 400);
container->setMaximumSize(800, 600);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout *lay = new QVBoxLayout(); QVBoxLayout *lay = new QVBoxLayout();
lay->setContentsMargins(0,0,0,0); lay->setContentsMargins(0,0,0,0);

View File

@ -75,8 +75,6 @@ FlightLogManager::~FlightLogManager() {
} }
void addEntries(QQmlListProperty<DebugLogEntry> *list, DebugLogEntry *entry) { void addEntries(QQmlListProperty<DebugLogEntry> *list, DebugLogEntry *entry) {
Q_UNUSED(list);
Q_UNUSED(entry);
} }
int countEntries(QQmlListProperty<DebugLogEntry> *list) { int countEntries(QQmlListProperty<DebugLogEntry> *list) {