Warning, /education/kalgebra/mobile/content/ui/main.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2015 by Aleix Pol <aleixpol@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtQuick.Controls as QQC2
0007 import QtQuick.Templates as T
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamiaddons.delegates as Delegates
0010 import org.kde.analitza
0011 import org.kde.kalgebra.mobile
0012
0013 Kirigami.ApplicationWindow
0014 {
0015 id: rootItem
0016 height: 800
0017 width: Kirigami.Units.gridUnit * 70
0018 visible: true
0019
0020 readonly property int columnWidth: Kirigami.Units.gridUnit * 13
0021 wideScreen: width > columnWidth * 5
0022
0023 Kirigami.PagePool {
0024 id: mainPagePool
0025 }
0026
0027 globalDrawer: Kirigami.OverlayDrawer {
0028 id: drawer
0029
0030 edge: Qt.application.layoutDirection === Qt.RightToLeft ? Qt.RightEdge : Qt.LeftEdge
0031
0032 modal: !rootItem.wideScreen
0033 onModalChanged: drawerOpen = !modal
0034 handleVisible: modal
0035 width: contentItem ? columnWidth : 0
0036
0037 leftPadding: 0
0038 rightPadding: 0
0039 topPadding: 0
0040 bottomPadding: 0
0041
0042 Kirigami.Theme.colorSet: Kirigami.Theme.View
0043 Kirigami.Theme.inherit: false
0044
0045 drawerOpen: true
0046
0047 readonly property list<T.Action> actions: [
0048 Kirigami.PagePoolAction {
0049 icon.name: "utilities-terminal"
0050 text: i18n("Calculator")
0051 page: "qrc:/Console.qml"
0052 pagePool: mainPagePool
0053 },
0054 Kirigami.PagePoolAction {
0055 id: show2dPlotAction
0056 icon.name: "draw-bezier-curves"
0057 text: i18n("Graph 2D")
0058 page: "qrc:/Plot2D.qml"
0059 pagePool: mainPagePool
0060 },
0061 Kirigami.PagePoolAction {
0062 id: show3dPlotAction
0063 icon.name: "adjustrgb"
0064 text: i18n("Graph 3D")
0065 page: "qrc:/Plot3D.qml"
0066 pagePool: mainPagePool
0067 },
0068 Kirigami.PagePoolAction {
0069 icon.name: "kspread"
0070 text: i18n("Value Tables")
0071 page: "qrc:/Tables.qml"
0072 pagePool: mainPagePool
0073 },
0074 Kirigami.PagePoolAction {
0075 icon.name: "document-properties"
0076 text: i18n("Variables")
0077 page: "qrc:/VariablesView.qml"
0078 pagePool: mainPagePool
0079 },
0080 Kirigami.PagePoolAction {
0081 icon.name: "documentation"
0082 text: i18n("Dictionary")
0083 page: "qrc:/Dictionary.qml"
0084 pagePool: mainPagePool
0085 },
0086 Kirigami.PagePoolAction {
0087 icon.name: "help-about"
0088 text: i18n("About KAlgebra")
0089 page: "qrc:/About.qml"
0090 pagePool: mainPagePool
0091 }
0092 ]
0093
0094 contentItem: ColumnLayout {
0095 spacing: 0
0096
0097 QQC2.ToolBar {
0098 Layout.fillWidth: true
0099 Layout.preferredHeight: rootItem.pageStack.globalToolBar.preferredHeight
0100 Layout.bottomMargin: Math.round(Kirigami.Units.smallSpacing / 2)
0101
0102 leftPadding: Kirigami.Units.smallSpacing
0103 rightPadding: Kirigami.Units.smallSpacing
0104 topPadding: Kirigami.Units.smallSpacing
0105 bottomPadding: Kirigami.Units.smallSpacing
0106
0107 contentItem: Kirigami.Heading {
0108 text: i18n("KAlgebra")
0109 }
0110 }
0111
0112 Repeater {
0113 delegate: Delegates.RoundedItemDelegate {
0114 required property var modelData
0115 action: modelData
0116 Layout.fillWidth: true
0117 }
0118 model: drawer.actions
0119 }
0120
0121 Item {
0122 Layout.fillHeight: true
0123 }
0124 }
0125 }
0126
0127 readonly property Component customDrawer: Kirigami.OverlayDrawer {
0128 leftPadding: 0
0129 rightPadding: 0
0130 topPadding: 0
0131 bottomPadding: 0
0132
0133 edge: Qt.application.layoutDirection == Qt.RightToLeft ? Qt.LeftEdge : Qt.RightEdge
0134 modal: !rootItem.wideScreen
0135 onModalChanged: drawerOpen = !modal
0136 drawerOpen: true
0137 onContentItemChanged: if (contentItem) {
0138 contentItem.visible = (mainPagePool.lastLoadedItem.drawerContent !== undefined);
0139 }
0140 width: mainPagePool.lastLoadedItem.drawerContent ? columnWidth : 0
0141
0142 contentItem: mainPagePool.lastLoadedItem.drawerContent ?? null
0143 handleVisible: mainPagePool.lastLoadedItem.drawerContent !== undefined
0144
0145 Kirigami.Theme.colorSet: Kirigami.Theme.View
0146 Kirigami.Theme.inherit: false
0147 }
0148
0149 readonly property Component normalDrawer: Kirigami.ContextDrawer {}
0150
0151 Component.onCompleted: if (Kirigami.Settings.isMobile) {
0152 contextDrawer = normalDrawer.createObject(rootItem);
0153 } else {
0154 contextDrawer = customDrawer.createObject(rootItem);
0155 }
0156
0157 pageStack.initialPage: mainPagePool.loadPage("qrc:/Console.qml")
0158 }