Skip to content

Commit

Permalink
Merge branch 'master' into feature-form-redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasMizera committed Feb 6, 2024
2 parents 573a39d + 0a91c56 commit ba955b8
Show file tree
Hide file tree
Showing 11 changed files with 519 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ set(MM_QML
components/MMCheckBox.qml
components/MMDrawer.qml
components/MMDropdownDrawer.qml
components/MMGpsDataDrawer.qml
components/MMHeader.qml
components/MMHlineText.qml
components/MMIcon.qml
Expand Down
307 changes: 307 additions & 0 deletions app/qml/components/MMGpsDataDrawer.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts
import "."
import ".."
import lc 1.0

Drawer {
id: root

property var title
property real rowHeight: 67 * __dp

width: ApplicationWindow.window.width
height: (mainColumn.height > ApplicationWindow.window.height ? ApplicationWindow.window.height : mainColumn.height) - 20 * __dp
edge: Qt.BottomEdge

Rectangle {
color: roundedRect.color
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 2 * radius
anchors.topMargin: -radius
radius: 20 * __dp
}

Rectangle {

id: roundedRect

anchors.fill: parent
color: __style.whiteColor

ColumnLayout {

id: mainColumn

width: parent.width
spacing: 40 * __dp

MMHeader {
id: header

rightMarginShift: 0
backVisible: false

title: qsTr("GPS info")
titleFont: __style.h3

MMRoundButton {
id: backBtn

anchors.right: parent.right
anchors.rightMargin: __style.pageMargins
anchors.verticalCenter: parent.verticalCenter

iconSource: __style.closeIcon
iconColor: __style.forestColor

bgndColor: __style.lightGreenColor
bgndHoverColor: __style.mediumGreenColor

onClicked: root.visible = false
}
}

ScrollView {
id: scrollView

Layout.fillWidth: true
Layout.leftMargin: 20 * __dp
Layout.rightMargin: 20 * __dp
Layout.maximumWidth: __style.maxPageWidth
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: {
if (ApplicationWindow.window){
var availableHeight = ApplicationWindow.window.height - header.height - mainColumn.spacing
var totalHeight = scrollColumn.childrenRect.height + 20 * __dp

if(totalHeight >= ApplicationWindow.window.height) {
return availableHeight
}
return totalHeight
}
return 0
}
contentWidth: availableWidth
contentHeight: scrollColumn.childrenRect.height

ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AlwaysOff

Column{
id: scrollColumn

width: parent.width
spacing: 0

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "Source" )
descriptionText: __positionKit.positionProvider ? __positionKit.providerName : qsTr( "No receiver" )
}

MMGpsDataText{
titleText: qsTr( "Status" )
descriptionText: __positionKit.positionProvider ? __positionKit.providerMessage : ""
alignmentRight: true
itemVisible: __positionKit.positionProvider && __positionKit.providerType === "external"
}
}

MMLine {}

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "Latitude" )
descriptionText: {
if ( !__positionKit.hasPosition || Number.isNaN( __positionKit.latitude ) ) {
qsTr( "N/A" )
}
__positionKit.latitude
}
}

MMGpsDataText{
titleText: qsTr( "Longitude")
descriptionText: {
if ( !__positionKit.hasPosition || Number.isNaN( __positionKit.longitude ) ) {
qsTr( "N/A" )
}
__positionKit.longitude
}
alignmentRight: true
}
}

MMLine {}

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "X" )
descriptionText: {
if ( !__positionKit.hasPosition || Number.isNaN( __positionKit.x ) ) {
qsTr( "N/A" )
}
__positionKit.x.toFixed(2)
}
}

MMGpsDataText{
titleText: qsTr( "Y" )
descriptionText: {
if ( !__positionKit.hasPosition || Number.isNaN( __positionKit.x ) ) {
qsTr( "N/A" )
}
__positionKit.y.toFixed(2)
}
alignmentRight: true
}
}

MMLine {}

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "Horizontal accuracy" )
descriptionText: {
if ( !__positionKit.hasPosition || __positionKit.horizontalAccuracy < 0 ) {
return qsTr( "N/A" )
}

__positionKit.horizontalAccuracy.toFixed(2) + " m"
}
}

MMGpsDataText{
titleText: qsTr( "Vertical accuracy" )
descriptionText: {
if ( !__positionKit.hasPosition || __positionKit.verticalAccuracy < 0 ) {
return qsTr( "N/A" )
}

__positionKit.verticalAccuracy.toFixed(2) + " m"
}
alignmentRight: true
}
}

MMLine {}

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "Altitude" )
descriptionText: {
if ( !__positionKit.hasPosition || Number.isNaN( __positionKit.altitude ) ) {
return qsTr( "N/A" )
}
__positionKit.altitude.toString() + " m"
}
}

MMGpsDataText{
titleText: qsTr( "Satellites (in use/view)" )
descriptionText: {
if ( __positionKit.satellitesUsed < 0 || __positionKit.satellitesVisible < 0 )
{
return qsTr( "N/A" )
}

__positionKit.satellitesUsed + "/" + __positionKit.satellitesVisible
}
alignmentRight: true
}
}

MMLine {}

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "Speed" )
descriptionText: {
if ( !__positionKit.hasPosition || __positionKit.speed < 0 ) {
return qsTr( "N/A" )
}

__positionKit.speed.toString(2) + " km/h"
}
}

MMGpsDataText{
titleText: qsTr( "Last Fix" )
descriptionText: __positionKit.lastRead || qsTr( "N/A" )
alignmentRight: true
}
}

MMLine {}

Row {
width: parent.width
height: rowHeight

MMGpsDataText{
titleText: qsTr( "GPS antenna height" )
descriptionText: __positionKit.gpsAntennaHeight > 0 ? __positionKit.gpsAntennaHeight.toString(3) + " m" : qsTr( "Not set" )
}
}

Item {
width: 1
height: 20 * __dp
}

MMButton {
id: primaryButton

width: parent.width - 2 * 20 * __dp
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 20

text: qsTr("Manage GPS receivers")

onClicked: {
console.log("GPS data drawer button test OK")
}
}

Item {
width: 2
height: 20 * __dp
}
}
}
}
}
}

53 changes: 53 additions & 0 deletions app/qml/components/MMGpsDataText.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import "."
import ".."
import lc 1.0
import QtQuick.Layouts

Item {
property string titleText: "title"
property string descriptionText: "description"
property bool alignmentRight: false
property bool itemVisible: true

width: parent.width / 2
height: parent.height

ColumnLayout {
width: parent.width
height: parent.height
visible: itemVisible
spacing: 0

Text {
text: titleText
color: __style.nightColor
font: __style.p6
elide: Text.ElideRight
horizontalAlignment: alignmentRight ? Text.AlignRight : Text.AlignLeft
Layout.fillWidth: true
width: parent.width
Layout.topMargin: 8
}

Text {
text: descriptionText
color: __style.nightColor
font: __style.t3
elide: Text.ElideMiddle
horizontalAlignment: alignmentRight ? Text.AlignRight : Text.AlignLeft
Layout.fillWidth: true
width: parent.width
Layout.bottomMargin: 8
}
}
}
23 changes: 23 additions & 0 deletions app/qml/components/MMLine.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import lc 1.0

Item {

width: parent.width
height: (1 * __dp) < 1 ? 1 : 1 * __dp

Rectangle {
width: parent.width
height: parent.height
color: __style.greyColor
}
}
Loading

1 comment on commit ba955b8

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.02.515311 just submitted!

Please sign in to comment.