2019-05-11 15:21:43 +02:00
/ *
blueROCK - for digital rock
Copyright ( C ) 2019 Dorian Zedler
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 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < http: //www.gnu.org/licenses/>.
* /
2021-06-05 21:18:21 +02:00
import QtQuick 2.9
2019-04-20 22:57:40 +02:00
import QtQuick . Controls 2.4
2021-06-05 21:18:21 +02:00
import QtQuick . Layouts 1.0
2021-06-08 19:23:55 +02:00
import QtQuick . Controls . Material 2.12
2019-04-20 22:57:40 +02:00
import "../Components"
Page {
id: root
title: "start"
2019-05-23 23:17:27 +02:00
2021-06-05 21:18:21 +02:00
signal headerComponentChanged ( )
2021-06-06 18:34:27 +02:00
BlueRockBadge {
id: headerBadge
2019-05-23 23:17:27 +02:00
anchors {
horizontalCenter: parent . horizontalCenter
top: parent . top
topMargin: root . height * 0.03
}
2021-06-20 15:09:53 +02:00
height: app . landscape ( ) ? menuGr . buttonSize * 0.2 : menuGr . buttonSize * 0.3
2019-05-23 23:17:27 +02:00
}
2019-04-20 22:57:40 +02:00
2021-06-17 13:50:18 +02:00
GridLayout {
2019-04-20 22:57:40 +02:00
id: menuGr
2021-06-17 15:08:34 +02:00
anchors.centerIn: parent
2019-04-20 22:57:40 +02:00
2021-06-17 15:08:34 +02:00
rows: app . landscape ( ) ? 1 : 2
columns: app . landscape ( ) ? 2 : 1
2019-04-20 22:57:40 +02:00
2021-06-17 13:50:18 +02:00
rowSpacing: app . landscape ( ) ? parent . width * 0.1 : headerBadge . anchors . topMargin
columnSpacing: rowSpacing
2019-04-20 22:57:40 +02:00
2021-06-17 13:50:18 +02:00
property int buttonSize: app . landscape ( ) ? parent . width * 0.2 : parent . height * 0.19
2019-04-20 22:57:40 +02:00
FancyButton {
id: davBt
2021-06-17 13:50:18 +02:00
Layout.preferredHeight: menuGr . buttonSize
Layout.preferredWidth: menuGr . buttonSize
Layout.alignment: Layout . Center
2019-04-20 22:57:40 +02:00
2021-06-08 19:23:55 +02:00
image: Material . theme === Material . Dark ? "qrc:/icons/dav-dark.png" : "qrc:/icons/dav.png"
2019-04-20 22:57:40 +02:00
onClicked: {
2019-05-24 14:15:07 +02:00
app . openWidget ( { nation: "GER" } )
2019-04-20 22:57:40 +02:00
}
}
FancyButton {
id: sacBt
2021-06-17 13:50:18 +02:00
Layout.preferredHeight: menuGr . buttonSize
Layout.preferredWidth: menuGr . buttonSize
Layout.alignment: Layout . Center
2019-04-20 22:57:40 +02:00
2021-06-08 19:23:55 +02:00
image: Material . theme === Material . Dark ? "qrc:/icons/sac-dark.png" : "qrc:/icons/sac.png"
2019-04-20 22:57:40 +02:00
onClicked: {
2019-05-24 14:15:07 +02:00
app . openWidget ( { nation: "SUI" } )
2019-04-20 22:57:40 +02:00
}
}
2021-06-17 15:08:34 +02:00
}
2021-06-20 15:09:53 +02:00
Grid {
2021-06-17 15:08:34 +02:00
id: footerMenu
2019-04-20 22:57:40 +02:00
2021-06-17 15:08:34 +02:00
anchors {
bottom: parent . bottom
margins: headerBadge . anchors . topMargin
horizontalCenter: parent . horizontalCenter
2021-06-05 21:18:21 +02:00
}
2021-06-20 15:09:53 +02:00
width: app . landscape ( ) ? childrenRect.width : parent . width * 0.8
2021-07-05 20:55:34 +02:00
height: app . landscape ( ) ? headerBadge.height : Math . min ( headerBadge . height * 2 , width * 0.27 )
2021-06-20 15:09:53 +02:00
columnSpacing: height * 0.1
2021-06-17 15:08:34 +02:00
columns: app . landscape ( ) ? 4 : 2
rows: app . landscape ( ) ? 1 : 2
Repeater {
id: buttonRepeater
property var buttons: [
2021-06-20 20:11:19 +02:00
//% "IFSC results"
2021-06-20 21:08:59 +02:00
[ "\uf059" , qsTrId ( "#ifscResults" ) , ifscDisclaimerDialog . open ] ,
2021-06-20 20:11:19 +02:00
[
"\uf042" ,
Material . theme === Material . Light ?
//% "Dark mode"
2021-06-20 21:08:59 +02:00
qsTrId ( "#darkMode" ) :
2021-06-20 20:11:19 +02:00
//% "Light mode"
2021-06-20 21:08:59 +02:00
qsTrId ( "#lightMode" ) ,
2021-06-20 20:11:19 +02:00
app . toggleDarkMode
] ,
//% "About blueROCK"
2021-06-20 21:08:59 +02:00
[ "\uf05a" , qsTrId ( "#aboutBluerock" ) , aboutBluerockDisclaimerDialog . open ] ,
2021-06-25 09:41:07 +02:00
[ "\uf029" , qsTrId ( "#scanQrCode" ) , function ( ) {
mainStack . push ( "qrc:/Pages/QrCodeScanPage.qml" )
} ] ,
2021-06-17 15:08:34 +02:00
]
2021-06-06 21:53:41 +02:00
2021-06-17 15:08:34 +02:00
model: buttons
2021-06-06 21:53:41 +02:00
2021-06-17 15:08:34 +02:00
delegate: Item {
2021-06-06 21:53:41 +02:00
2021-06-20 15:09:53 +02:00
width: app . landscape ( ) ? footerMenuButton.implicitWidth : footerMenu . width * 0.5 - ( footerMenu . columnSpacing / 2 )
height: app . landscape ( ) ? footerMenu.height : footerMenu . height * 0.5 - ( footerMenu . rowSpacing / 2 )
2021-06-17 13:50:18 +02:00
2021-06-17 15:08:34 +02:00
Button {
id: footerMenuButton
2021-06-20 15:09:53 +02:00
2021-06-17 15:08:34 +02:00
property bool isLeft: index % 2 === 0
anchors {
right: isLeft && ! app . landscape ( ) ? parent.right : undefined
left: isLeft && ! app . landscape ( ) ? undefined : parent . left
centerIn: app . landscape ( ) ? parent : undefined
}
2021-06-06 21:53:41 +02:00
2021-06-20 15:09:53 +02:00
height: parent . height
2021-06-17 13:50:18 +02:00
flat: true
2021-06-06 21:53:41 +02:00
2021-06-17 13:50:18 +02:00
font.family: fa5solid . name
font.pixelSize: height * 0.4
font.capitalization: Font . MixedCase
2021-06-17 15:08:34 +02:00
//horizontalAlignment: isLeft ? Text.AlignRight : Text.AlignLeft
2021-06-06 21:53:41 +02:00
2021-06-17 15:08:34 +02:00
text: isLeft && ! app . landscape ( ) ? modelData [ 1 ] + " " + modelData [ 0 ] : modelData [ 0 ] + " " + modelData [ 1 ]
2021-06-05 21:18:21 +02:00
2021-06-17 15:08:34 +02:00
onClicked: buttonRepeater . buttons [ index ] [ 2 ] ( )
}
2021-06-17 13:50:18 +02:00
}
2019-05-23 23:17:27 +02:00
}
}
2021-06-05 21:18:21 +02:00
2021-06-06 21:53:41 +02:00
DisclaimerDialog {
id: ifscDisclaimerDialog
2021-06-08 19:23:55 +02:00
Material.theme: root . Material . theme
2021-06-20 21:08:59 +02:00
//% "Where are the IFSC results?"
title: qsTrId ( "#ifscDisclaimerTitle" )
//% "Unfortunately, the IFSC has restricted the access to their data and <b>is not willing to share results with blueROCK anymore</b>. Because of this, blueROCK is no longer able to access and display IFSC results.<br><br>You can find current IFSC results <a href=\"https://ifsc.results.info\">over here</a> and on <a href=\"https://ifsc-climbing.org\">their website</a>."
content: qsTrId ( "#ifscDisclaimer" )
2021-06-06 21:53:41 +02:00
}
2021-06-06 18:34:27 +02:00
2021-06-06 21:53:41 +02:00
DisclaimerDialog {
id: aboutBluerockDisclaimerDialog
2021-06-08 19:23:55 +02:00
Material.theme: root . Material . theme
2021-10-20 20:21:45 +02:00
//% "privacy policy"
title: "blueROCK v" + APP_VERSION + "<br>By <a href=\"https://itsblue.de\">Itsblue Development</a>, <a href=\"https://itsblue.de/apps/bluerock\">" + qsTrId ( "#privacyPolicy" ) + "</a>"
2021-08-06 21:39:29 +02:00
//% "This app was built using the <a href='https://qt.io'>Qt Framework</a> licensed under the <a href='https://www.gnu.org/licenses/lgpl-3.0.en.html'>GNU lgplV3 license</a>.<br><br>This app is open source and licensed under the <a href='https://www.gnu.org/licenses/agpl-3.0.en.html'>GNU agplV3 license</a>, the source code can be found <a href='https://itsblue.dev/blueROCK/app'>here</a>.<br><br>Resultservice and rankings provided by <a href='http://www.digitalROCK.de'>digital ROCK</a>."
2021-06-20 21:08:59 +02:00
content: qsTrId ( "#aboutBluerockDisclaimer" )
2021-06-20 15:09:53 +02:00
}
2019-04-20 22:57:40 +02:00
}