Skip to content

Commit

Permalink
Merge pull request #5415 from opengisch/qmlformat-pre-commit
Browse files Browse the repository at this point in the history
qmlformat --reformat-codebase
  • Loading branch information
m-kuhn authored Jul 4, 2024
2 parents 224a6a0 + 7c8fb2d commit 57b3067
Show file tree
Hide file tree
Showing 109 changed files with 10,280 additions and 10,793 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,9 @@ repos:
files: .zenodo.json
types: [json]
args: ["--schemafile", "https://raw.githubusercontent.com/rouault/zenodo_json_schema/master/zenodo-json-schema.json"]


- repo: https://github.com/nrbnlulu/qt-hooks
rev: v0.1.0 # current revision
hooks:
- id: qml-format
5 changes: 5 additions & 0 deletions .qmlformat.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[General]
IndentWidth=2
NewlineType=native
NormalizeOrder=
UseTabs=
318 changes: 155 additions & 163 deletions src/qml/About.qml
Original file line number Diff line number Diff line change
@@ -1,198 +1,190 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14

import Theme 1.0
import org.qfield 1.0

Item {
id: aboutPanel

Rectangle {
color: "black"
opacity: 0.8
id: aboutPanel

Rectangle {
color: "black"
opacity: 0.8
anchors.fill: parent
}

ColumnLayout {
id: aboutContainer
spacing: 6
anchors.fill: parent
anchors.margins: 20
anchors.topMargin: 20 + mainWindow.sceneTopMargin
anchors.bottomMargin: 20 + mainWindow.sceneBottomMargin

ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AsNeeded
contentItem: information
contentWidth: information.width
contentHeight: information.height
clip: true

MouseArea {
anchors.fill: parent
}
onClicked: aboutPanel.visible = false
}

ColumnLayout {
id: aboutContainer
ColumnLayout {
id: information
spacing: 6
anchors.fill: parent
anchors.margins: 20
anchors.topMargin: 20 + mainWindow.sceneTopMargin
anchors.bottomMargin: 20 + mainWindow.sceneBottomMargin

ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AsNeeded
contentItem: information
contentWidth: information.width
contentHeight: information.height
clip: true

MouseArea {
anchors.fill: parent
onClicked: aboutPanel.visible = false
}

ColumnLayout {
id: information
spacing: 6
width: aboutPanel.width - 40
height: Math.max(mainWindow.height - linksButton.height * 2 - qfieldAppDirectoryLabel.height - aboutContainer.spacing * 3 - aboutContainer.anchors.topMargin - aboutContainer.anchors.bottomMargin,
qfieldPart.height + opengisPart.height + spacing)

ColumnLayout {
id: qfieldPart
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter

MouseArea {
Layout.preferredWidth: 138
Layout.preferredHeight: 138
Image {
id: qfieldLogo
width: parent.width
height: parent.height
source: "qrc:/images/qfield_logo.svg"
sourceSize.width: width * screen.devicePixelRatio
sourceSize.height: height * screen.devicePixelRatio
}
onClicked: Qt.openUrlExternally("https://qfield.org/")
}

Label {
Layout.fillWidth: true
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
font: Theme.strongFont
color: Theme.light
textFormat: Text.RichText
text: {
var links = '<a href="https://github.com/opengisch/QField/commit/' + gitRev + '">' + gitRev.substr(0, 6) + '</a>'

if (appVersion && appVersion !== '1.0.0')
links += ' <a href="https://github.com/opengisch/QField/releases/tag/' + appVersion + '">' + appVersion + '</a>'

return "QField<br>" + appVersionStr + " (" + links + ")<br>Qt " + qVersion
}
onLinkActivated: Qt.openUrlExternally(link)
}
}

ColumnLayout {
id: opengisPart
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter

MouseArea {
Layout.preferredWidth: 91
Layout.preferredHeight:113
Image {
id: opengisLogo
width: parent.width
height: parent.height
source: "qrc:/images/opengis-logo.svg"
sourceSize.width: width * screen.devicePixelRatio
sourceSize.height: height * screen.devicePixelRatio
}
onClicked: Qt.openUrlExternally("https://opengis.ch")
}

Label {
Layout.fillWidth: true
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
font: Theme.strongFont
color: Theme.light
textFormat: Text.RichText
text: qsTr( "Developed by" ) + '<br><a href="https://opengis.ch">OPENGIS.ch</a>'
onLinkActivated: Qt.openUrlExternally(link)
}
}
width: aboutPanel.width - 40
height: Math.max(mainWindow.height - linksButton.height * 2 - qfieldAppDirectoryLabel.height - aboutContainer.spacing * 3 - aboutContainer.anchors.topMargin - aboutContainer.anchors.bottomMargin, qfieldPart.height + opengisPart.height + spacing)

ColumnLayout {
id: qfieldPart
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter

MouseArea {
Layout.preferredWidth: 138
Layout.preferredHeight: 138
Image {
id: qfieldLogo
width: parent.width
height: parent.height
source: "qrc:/images/qfield_logo.svg"
sourceSize.width: width * screen.devicePixelRatio
sourceSize.height: height * screen.devicePixelRatio
}
}
onClicked: Qt.openUrlExternally("https://qfield.org/")
}

Label {
id: qfieldAppDirectoryLabel
Label {
Layout.fillWidth: true
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
font: Theme.tinyFont
font: Theme.strongFont
color: Theme.light
opacity: 0.6

textFormat: Text.RichText
text: {
var dataDirs = platformUtilities.appDataDirs();
if (dataDirs.length > 0) {
return (dataDirs.length > 1
? 'QField app directories'
: 'QField app directory')
+ '\n' + dataDirs.join('\n');
}
return '';
var links = '<a href="https://github.com/opengisch/QField/commit/' + gitRev + '">' + gitRev.substr(0, 6) + '</a>';
if (appVersion && appVersion !== '1.0.0')
links += ' <a href="https://github.com/opengisch/QField/releases/tag/' + appVersion + '">' + appVersion + '</a>';
return "QField<br>" + appVersionStr + " (" + links + ")<br>Qt " + qVersion;
}
onLinkActivated: Qt.openUrlExternally(link)
}
}

QfButton {
id: sponsorshipButton
ColumnLayout {
id: opengisPart
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter

MouseArea {
Layout.preferredWidth: 91
Layout.preferredHeight: 113
Image {
id: opengisLogo
width: parent.width
height: parent.height
source: "qrc:/images/opengis-logo.svg"
sourceSize.width: width * screen.devicePixelRatio
sourceSize.height: height * screen.devicePixelRatio
}
onClicked: Qt.openUrlExternally("https://opengis.ch")
}

Label {
Layout.fillWidth: true
icon.source: Theme.getThemeVectorIcon( 'ic_sponsor_white_24dp' )
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
font: Theme.strongFont
color: Theme.light
textFormat: Text.RichText
text: qsTr("Developed by") + '<br><a href="https://opengis.ch">OPENGIS.ch</a>'
onLinkActivated: Qt.openUrlExternally(link)
}
}
}
}

text: qsTr( 'Support QField')
onClicked: Qt.openUrlExternally("https://github.com/sponsors/opengisch")
Label {
id: qfieldAppDirectoryLabel
Layout.fillWidth: true
Layout.maximumWidth: parent.width
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
font: Theme.tinyFont
color: Theme.light
opacity: 0.6

text: {
var dataDirs = platformUtilities.appDataDirs();
if (dataDirs.length > 0) {
return (dataDirs.length > 1 ? 'QField app directories' : 'QField app directory') + '\n' + dataDirs.join('\n');
}
return '';
}
}

QfButton {
id: linksButton
dropdown: true
Layout.fillWidth: true
icon.source: Theme.getThemeVectorIcon( 'ic_book_white_24dp' )
QfButton {
id: sponsorshipButton
Layout.fillWidth: true
icon.source: Theme.getThemeVectorIcon('ic_sponsor_white_24dp')

text: qsTr( 'Documentation' )
text: qsTr('Support QField')
onClicked: Qt.openUrlExternally("https://github.com/sponsors/opengisch")
}

QfButton {
id: linksButton
dropdown: true
Layout.fillWidth: true
icon.source: Theme.getThemeVectorIcon('ic_book_white_24dp')

onClicked: {
Qt.openUrlExternally("https://docs.qfield.org/")
}
text: qsTr('Documentation')

onDropdownClicked: {
linksMenu.popup(linksButton.width - linksMenu.width + 10, linksButton.y + 10)
}
}
}
onClicked: {
Qt.openUrlExternally("https://docs.qfield.org/");
}

Menu {
id: linksMenu
title: qsTr( "Links Menu" )

width: {
var result = 0;
var padding = 0;
for (var i = 0; i < count; ++i) {
var item = itemAt(i);
result = Math.max(item.contentItem.implicitWidth, result);
padding = Math.max(item.padding, padding);
}
return result + padding * 2;
}
onDropdownClicked: {
linksMenu.popup(linksButton.width - linksMenu.width + 10, linksButton.y + 10);
}
}
}

Menu {
id: linksMenu
title: qsTr("Links Menu")

width: {
var result = 0;
var padding = 0;
for (var i = 0; i < count; ++i) {
var item = itemAt(i);
result = Math.max(item.contentItem.implicitWidth, result);
padding = Math.max(item.padding, padding);
}
return result + padding * 2;
}

MenuItem {
text: qsTr('Changelog')
MenuItem {
text: qsTr('Changelog')

font: Theme.defaultFont
height: 48
leftPadding: Theme.menuItemLeftPadding
icon.source: Theme.getThemeVectorIcon( 'ic_speaker_white_24dp' )
font: Theme.defaultFont
height: 48
leftPadding: Theme.menuItemLeftPadding
icon.source: Theme.getThemeVectorIcon('ic_speaker_white_24dp')

onTriggered: {
changelogPopup.open()
}
}
onTriggered: {
changelogPopup.open();
}
}
}
}
Loading

0 comments on commit 57b3067

Please sign in to comment.