Skip to content

Commit

Permalink
Tiny bad layers page refactoring to fix warning and better compartmen…
Browse files Browse the repository at this point in the history
…talize item
  • Loading branch information
nirvn committed Apr 20, 2024
1 parent 285e38e commit e5e4551
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 34 deletions.
48 changes: 28 additions & 20 deletions src/qml/BadLayerItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@ import org.qfield 1.0
import Theme 1.0

Page {
id: badLayerPage

property alias model: table.model
signal finished

padding: 5

width: mainWindow.width
height: mainWindow.height

header: PageHeader {
title: qsTr( 'Unable to load some layers' )
title: qsTr( 'Unable to load some layers' )

showBackButton: false
showApplyButton: false
showCancelButton: true
showBackButton: false
showApplyButton: false
showCancelButton: true

topMargin: mainWindow.sceneTopMargin
topMargin: mainWindow.sceneTopMargin

onFinished: parent.finished()
}
onFinished: badLayerPage.visible = false
}

ColumnLayout {
anchors.margins: 8
Expand All @@ -30,15 +35,13 @@ Page {
spacing: 10

Label {
Layout.fillWidth: true
Layout.fillHeight: false

text: qsTr( "The following layers could not be loaded, please review those and reconfigure the QGIS project." )
font: Theme.defaultFont
color: Theme.mainTextColor

wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: contentHeight
Layout.maximumHeight: contentHeight
}

Rectangle {
Expand All @@ -56,6 +59,14 @@ Page {
spacing: 2
anchors.fill: parent

model: BadLayerHandler {
project: qgisProject

onBadLayersFound: {
badLayerPage.visible = true
}
}

delegate: Rectangle {
id: rectangle
width: parent ? parent.width : undefined
Expand Down Expand Up @@ -91,20 +102,17 @@ Page {
}

Label {
Layout.fillWidth: true
Layout.fillHeight: false
Layout.topMargin: 5

text: qsTr( 'You may check the %1Portable Project%2 documentation page for more help.')
.arg( "<a href=\"https://docs.qfield.org/how-to/movable-project\">" )
.arg( "</a>" )

textFormat: Text.RichText
font: Theme.tipFont
color: Theme.secondaryTextColor

wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumHeight: contentHeight
Layout.maximumHeight: contentHeight
Layout.topMargin: 5

onLinkActivated: (link) => { Qt.openUrlExternally(link) }
}
Expand Down
14 changes: 0 additions & 14 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3580,21 +3580,7 @@ ApplicationWindow {

BadLayerItem {
id: badLayersView

anchors.fill: parent
model: BadLayerHandler {
project: qgisProject

onBadLayersFound: {
badLayersView.visible = true
}
}

visible: false

onFinished: {
visible = false
}
}

Item {
Expand Down

0 comments on commit e5e4551

Please sign in to comment.