Warning, /utilities/klimbgrades/src/Global.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2016 Marco Martin <mart@kde.org> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU Library General Public License as 0006 * published by the Free Software Foundation; either version 2, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU Library General Public License for more details 0013 * 0014 * You should have received a copy of the GNU Library General Public 0015 * License along with this program; if not, write to the 0016 * Free Software Foundation, Inc., 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 import QtQuick 2.0 0021 import QtQuick.Layouts 1.15 0022 import QtQuick.Controls 2.0 as Controls 0023 import org.kde.kirigami 2.19 as Kirigami 0024 0025 Kirigami.ScrollablePage { 0026 id: root 0027 0028 property var model 0029 property int defaultGrade 0030 0031 Kirigami.ColumnView.fillWidth: true 0032 Kirigami.ColumnView.reservedSpace: Kirigami.ColumnView.view.width/2 0033 0034 //Close the drawer with the back button 0035 onBackRequested: { 0036 if (sheet.sheetOpen) { 0037 event.accepted = true; 0038 sheet.close(); 0039 } 0040 } 0041 0042 actions { 0043 main: Kirigami.Action { 0044 iconName: "view-refresh" 0045 text: qsTr("Reset") 0046 onTriggered: root.model.currentGrade = root.defaultGrade; 0047 } 0048 contextualActions: [ 0049 Kirigami.Action { 0050 text: qsTr("Set Record") 0051 tooltip: qsTr("Set Grade As Personal Record") 0052 iconName: "games-highscores" 0053 onTriggered: { 0054 root.model.personalRecord = root.model.currentGrade; 0055 } 0056 }, 0057 Kirigami.Action { 0058 text: qsTr("Clear") 0059 tooltip: qsTr("Clear Personal Record") 0060 iconName: "edit-clear" 0061 enabled: root.model.personalRecord > 0 0062 onTriggered: { 0063 root.model.personalRecord = 0; 0064 } 0065 } 0066 ] 0067 } 0068 0069 Kirigami.OverlaySheet { 0070 id: sheet 0071 parent: applicationWindow().overlay 0072 property alias description: descrLabel.text 0073 property string url 0074 ColumnLayout { 0075 property int implicitWidth: Kirigami.Units.gridUnit * 25 0076 Controls.Label { 0077 id: descrLabel 0078 Layout.fillWidth: true 0079 wrapMode: Text.WordWrap 0080 } 0081 Controls.Button { 0082 Layout.alignment: Qt.AlignHCenter 0083 text: qsTr("Source: Wikipedia") 0084 onClicked: { 0085 Qt.openUrlExternally(sheet.url); 0086 sheet.close(); 0087 } 0088 } 0089 } 0090 } 0091 0092 ColumnLayout { 0093 id: mainLayout 0094 spacing: 0 0095 0096 Kirigami.AbstractCard { 0097 Layout.topMargin: Kirigami.Units.largeSpacing 0098 Layout.fillWidth: true 0099 contentItem: ColumnLayout { 0100 spacing: 0 0101 Repeater { 0102 id: repeater 0103 model: root.model 0104 delegate: GradeWidgetBase { 0105 page: root 0106 availableGradesModel: root.model 0107 isLast: index == repeater.count - 1 0108 } 0109 } 0110 } 0111 } 0112 } 0113 }