Skip to content

Commit

Permalink
solving first problem: hiding tracking layer when recording
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Jan 2, 2025
1 parent 185dfb9 commit 147e7ac
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
10 changes: 10 additions & 0 deletions app/inpututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2222,3 +2222,13 @@ double InputUtils::pixelDistanceBetween( const QPointF &p1, const QPointF &p2 )
{
return std::hypot( p1.x() - p2.x(), p1.y() - p2.y() );
}

bool InputUtils::isPositionTrackingLayerId( const QString &layerId, QgsProject *project )
{
if ( layerId.isEmpty() || !project )
return false;

QString trackingLayerId = project->readEntry( QStringLiteral( "Mergin" ), QStringLiteral( "PositionTracking/TrackingLayer" ), QString() );

return layerId == trackingLayerId;
}
5 changes: 5 additions & 0 deletions app/inpututils.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ class InputUtils: public QObject
*/
static double pixelDistanceBetween( const QPointF &p1, const QPointF &p2 );

/**
* Returns true if the layerId corresponds to position tracking layer id
*/
Q_INVOKABLE bool isPositionTrackingLayerId( const QString &layerId, QgsProject *project );

public slots:
void onQgsLogMessageReceived( const QString &message, const QString &tag, Qgis::MessageLevel level );

Expand Down
18 changes: 15 additions & 3 deletions app/qml/components/MMListDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,26 @@ Item {
property alias rightContent: rightContentGroup.children

property bool hasLine: {
// calculate automatically when this item is a delegate in list
if ( !visible )
return false;

// calculate automatically when this item is a delegate in list
if ( typeof index != "undefined" ) {
if ( ListView?.view ?? false ) {
return index < ListView.view.count - 1
// hide line if this is the last item
if ( index >= ListView.view.count - 1 )
return false;

// hide line if next item is invisible
var nextItem = ListView.view.itemAtIndex( index + 1 );
if ( nextItem && !nextItem.visible )
return false;

return true;
}
}

return true
return true;
}

property real verticalSpacing: root.secondaryText ? __style.margin8 : __style.margin20
Expand Down
2 changes: 2 additions & 0 deletions app/qml/map/MMMapController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,8 @@ Item {
// TODO: why we need to set hight here?
height: __style.menuDrawerHeight

visible: !__inputUtils.isPositionTrackingLayerId( model.layerId, __activeProject.qgsProject )

leftContent: MMIcon {
source: model.iconSource
}
Expand Down

1 comment on commit 147e7ac

@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 25.1.697311 just submitted!

Please sign in to comment.