Skip to content

Commit

Permalink
Merge pull request #5251 from opengisch/NavigatingDrawer
Browse files Browse the repository at this point in the history
Information drawer functionality
  • Loading branch information
nirvn committed May 20, 2024
2 parents 99d8b7c + f8cd5a8 commit dc41638
Show file tree
Hide file tree
Showing 8 changed files with 1,096 additions and 1,070 deletions.
85 changes: 85 additions & 0 deletions src/qml/InformationDrawer.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import QtQuick 2.14
import QtQuick.Controls 2.14

import org.qfield 1.0
import Theme 1.0

Item {
id: controller

anchors.bottom: parent.bottom
anchors.leftMargin: 10
anchors.rightMargin: 10

width: parent.width
height: mainContent.height + (mainContent.height > 0 ? 10 : 0)
Behavior on height {
PropertyAnimation {
easing.type: Easing.OutQuart
}
}

property real itemRadius: 8

// SensorInformationView
property bool sensorInformationViewEnabled: sensorInformationView.activeSensors > 0

// NavigationInformationView
property bool navigationInformationViewEnabled: navigation.isActive && !elevationProfile.visible

// PositioningInformationView
property Navigation navigation
property bool positioningInformationViewEnabled: positioningSettings.showPositionInformation && !elevationProfile.visible

// PositioningPreciseView
property alias positioningPreciseView: positioningPreciseView
property PositioningSettings positioningSettings
property Positioning positionSource
property real positioningPreciseViewHeight
property bool positioningPreciseEnabled: !elevationProfile.visible
&& !isNaN(navigation.distance)
&& navigation.isActive
&& (positioningSettings.alwaysShowPreciseView
|| ( positioningPreciseView.hasAcceptableAccuracy
&& positioningPreciseView.projectDistance < positioningPreciseView.precision ))

Column {
id: mainContent
width: parent.width - 8
anchors.horizontalCenter: parent.horizontalCenter
spacing: 8

NavigationInformationView {
id: navigationInformationView
width: parent.width
height: navigationInformationViewEnabled ? contentHeight : 0
clip: true
navigation: controller.navigation
radius: itemRadius
}

PositioningInformationView {
id: positioningInformationView
width: parent.width
height: positioningInformationViewEnabled ? contentHeight : 0
clip: true
visible: positioningInformationViewEnabled
positionSource: controller.positionSource
antennaHeight: positioningSettings.antennaHeightActivated ? positioningSettings.antennaHeight : NaN
radius: itemRadius
}

PositioningPreciseView {
id: positioningPreciseView
width: parent.width
height: positioningPreciseEnabled ? positioningPreciseViewHeight : 0
clip: true
precision: positioningSettings.preciseViewPrecision
}

SensorInformationView {
id: sensorInformationView
height: sensorInformationViewEnabled ? contentHeight : 0
}
}
}
15 changes: 7 additions & 8 deletions src/qml/NavigationInformationView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ Rectangle {

property int ceilsCount: 4
property double rowHeight: 30
property color backgroundColor: Theme.mainBackgroundColor
property color backgroundColor: "transparent"
property color alternateBackgroundColor: Theme.navigationBackgroundColor
property color textColor: Theme.mainTextColor
property real contentHeight: content.height

height: childrenRect.height
width: parent.width
anchors.margins: 20

color: Theme.mainBackgroundColor
color: Theme.mainBackgroundColorSemiOpaque
border.color: alternateBackgroundColor
border.width: 2

Timer {
id: featureVertexTimer
Expand All @@ -46,13 +45,13 @@ Rectangle {
}

ColumnLayout {
id: content
width: parent.width
spacing: 0

Rectangle {
Item {
Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
color: Theme.navigationColor

RowLayout {
width: parent.width
Expand Down
6 changes: 3 additions & 3 deletions src/qml/PositioningInformationView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Rectangle {

property double antennaHeight: NaN
property double rowHeight: 30
property color backgroundColor: Theme.mainBackgroundColor
property color backgroundColor: "transparent"
property color alternateBackgroundColor: Theme.positionBackgroundColor
property color textColor: positionSource.currentness ? Theme.mainTextColor : Theme.secondaryTextColor

height: grid.rows * positioningInformationView.rowHeight
property real contentHeight: grid.rows * positioningInformationView.rowHeight
width: parent.width
anchors.margins: 20

color: Theme.mainBackgroundColor
color: Theme.mainBackgroundColorSemiOpaque

Grid {
id: grid
Expand Down
3 changes: 2 additions & 1 deletion src/qml/PositioningPreciseView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Item {

Rectangle {
anchors.fill: parent
color: Theme.mainBackgroundColor
color: "#ee" + Theme.mainBackgroundColor.toString().slice(1)
radius: 8
}

Row {
Expand Down
6 changes: 3 additions & 3 deletions src/qml/SensorInformationView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Rectangle {
property color backgroundColor: Theme.mainBackgroundColor
property color alternateBackgroundColor: Theme.sensorBackgroundColor
property color textColor: Theme.mainTextColor

width: parent.width
height: parent.width > 620
property real contentHeight: parent.width > 620
? rowHeight * Math.ceil(grid.count / 3)
: rowHeight * Math.ceil(grid.count / 2)

width: parent.width
anchors.margins: 20

color: Theme.mainBackgroundColor
Expand Down
2 changes: 2 additions & 0 deletions src/qml/imports/Theme/Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ QtObject {
property bool darkTheme: false

property color mainBackgroundColor: darkTheme ? "#303030" : "#fafafa"
property color mainBackgroundColorSemiOpaque: darkTheme ? "#dd303030" : "#ddfafafa"

property color mainTextColor: darkTheme ? "#EEEEEE" : "#000000"
readonly property color mainTextDisabledColor: darkTheme ? "#73EEEEEE" : "#73000000"
readonly property color mainColor: "#80cc28"
Expand Down

1 comment on commit dc41638

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please sign in to comment.