1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +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
spacing: 10
ScrollView {
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
frameVisible: true
ListView {
id: authorsView
border.width: 1
radius: 4
ColumnLayout {
anchors.margins: 10
anchors.fill: parent
spacing: 3
model: logManager.logEntries
delegate: Text {
Text {
Layout.fillWidth: true
text: "<b>" + qsTr("Log entries") + "</b>"
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 {
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 {
Layout.fillWidth: true
}
Text {
font.pixelSize: 12
text: "<b>" + qsTr("Flight to download:") + "</b>"
}
ColumnLayout {
spacing: 10
RowLayout {
Rectangle {
Layout.fillWidth: true
}
Text {
font.pixelSize: 12
text: "<b>" + qsTr("Flight to download:") + "</b>"
}
ComboBox {
id: flightCombo
property ListModel dataModel: ListModel {}
model: dataModel
Component.onCompleted: {
dataModel.append({"value": "All"})
for (var a = 0; a <= logStatus.Flight ; a++) {
dataModel.append({"value": (a + 1).toString()})
ComboBox {
id: flightCombo
property ListModel dataModel: ListModel {}
model: dataModel
Component.onCompleted: {
dataModel.append({"value": "All"})
for (var a = 0; a <= logStatus.Flight ; a++) {
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 {
Layout.fillWidth: true
height: 40

View File

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

View File

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