blob: 23f8926646cc085d2acbae4d4fe93a72356e4fc7 [file] [log] [blame]
swissChilid2af6ad2022-04-16 14:42:17 -07001import QtQuick 2.0
swissChili23958ca2022-02-21 19:23:34 -08002import QtQuick.Controls 2.15
3import QtQuick.Controls.Material 2.0
swissChilid2af6ad2022-04-16 14:42:17 -07004import QtQuick.Layouts 1.11
swissChili4b3105a2022-02-22 16:34:39 -08005
swissChili23958ca2022-02-21 19:23:34 -08006ApplicationWindow {
7 id: root
swissChilid2af6ad2022-04-16 14:42:17 -07008
9 title: "REFAL Studio"
10
11 width: 680
12 height: 360
13
14 minimumWidth: 680
15 minimumHeight: 360
swissChili23958ca2022-02-21 19:23:34 -080016
swissChili4b3105a2022-02-22 16:34:39 -080017 Material.theme: Material.Light
swissChili23958ca2022-02-21 19:23:34 -080018 Material.accent: Material.Orange
19
swissChilid2af6ad2022-04-16 14:42:17 -070020 visible: true
swissChili505de412022-03-24 12:35:08 -070021
swissChilid2af6ad2022-04-16 14:42:17 -070022 function openNotebook(path=null) {
23 let NbWindow = Qt.createComponent("qrc:///qml/NbWindow.qml");
24 let window = NbWindow.createObject(null, {welcomeWindow: root});
swissChili505de412022-03-24 12:35:08 -070025
swissChilid2af6ad2022-04-16 14:42:17 -070026 if (path !== null)
swissChili505de412022-03-24 12:35:08 -070027 {
swissChilid2af6ad2022-04-16 14:42:17 -070028 window.openNotebook(path)
swissChili505de412022-03-24 12:35:08 -070029 }
swissChili4b3105a2022-02-22 16:34:39 -080030 }
31
swissChilid2af6ad2022-04-16 14:42:17 -070032 function toggleVisible() {
33 if (visible)
34 hide();
35 else
36 show();
37 }
swissChili23958ca2022-02-21 19:23:34 -080038
swissChilid2af6ad2022-04-16 14:42:17 -070039 Label {
40 id: textRefal
41 text: qsTr("REFAL")
42 anchors.left: parent.left
43 anchors.top: parent.top
44 font.pixelSize: 36
45 anchors.leftMargin: 36
46 anchors.topMargin: 29
47 font.weight: Font.Black
48 font.bold: true
49 font.italic: false
50 }
swissChili23958ca2022-02-21 19:23:34 -080051
swissChilid2af6ad2022-04-16 14:42:17 -070052 Label {
53 id: textStudio
54 y: 29
55 text: qsTr("Studio")
56 anchors.verticalCenter: textRefal.verticalCenter
57 anchors.left: textRefal.right
58 font.pixelSize: 36
59 anchors.leftMargin: 6
60 font.bold: false
61 font.italic: false
62 font.weight: Font.Medium
63 color: Material.color(Material.Orange)
64 }
swissChili23958ca2022-02-21 19:23:34 -080065
swissChilid2af6ad2022-04-16 14:42:17 -070066 Rectangle {
67 id: sepRect
68 x: 364
69 width: 1
70 color: "#cecece"
71 anchors.top: parent.top
72 anchors.bottom: parent.bottom
73 anchors.bottomMargin: 14
74 anchors.topMargin: 78
75 anchors.horizontalCenter: parent.horizontalCenter
76 }
77
78 Flickable {
79 id: notebooksFlick
80 anchors.left: textRefal.left
81 anchors.right: sepRect.left
82 anchors.top: textRefal.bottom
83 anchors.bottom: parent.bottom
84 anchors.leftMargin: -8
85 anchors.rightMargin: 16
86 anchors.bottomMargin: 16
87 anchors.topMargin: 6
88 clip: true
89 flickableDirection: Flickable.VerticalFlick
90
91 ColumnLayout {
92 id: notebooksCol
93 spacing: 12
94
95 RowLayout {
96 id: nbBtnsRow
97 spacing: 12
98 Layout.alignment: Qt.AlignLeft | Qt.AlignTop
99 Layout.fillWidth: true
100 Layout.fillHeight: false
101 Layout.leftMargin: 8
102 Layout.rightMargin: 8
103
104 Button {
105 id: newNotebookBtn
106 text: qsTr("New Notebook")
107 font.bold: true
108 highlighted: true
109
110 onClicked: {
111 root.openNotebook();
112 }
113 }
114
115 Button {
116 id: openNotebookBtn
117 text: qsTr("Open Existing")
118 }
swissChili23958ca2022-02-21 19:23:34 -0800119 }
120
swissChilid2af6ad2022-04-16 14:42:17 -0700121 Repeater {
122 id: notebooksList
123
124 Layout.alignment: Qt.AlignLeft | Qt.AlignTop
125 Layout.fillWidth: true
126 Layout.fillHeight: false
127
128 model: [
129 // "~/Documents/Hello.refnb", "~/Downloads/stuff/Goodbye.refnb", "/home/ch/dev/REFAL/build/test.refnb"
130 ]
131
132 delegate: RecentNotebook {
133 Layout.leftMargin: 8
134 Layout.rightMargin: 8
135
136 name: modelData.split("/").pop()
137
138 ToolTip.text: modelData
139 ToolTip.visible: containsMouse
140 ToolTip.delay: 1000
141
142 onClicked: root.openNotebook(modelData)
143 }
swissChili23958ca2022-02-21 19:23:34 -0800144 }
145
swissChilid2af6ad2022-04-16 14:42:17 -0700146 Label {
147 Layout.leftMargin: 8
148 Layout.rightMargin: 8
149
150 visible: notebooksList.count == 0
151 text: qsTr("Your recent notebooks will appear here")
swissChili23958ca2022-02-21 19:23:34 -0800152 }
153 }
swissChilid2af6ad2022-04-16 14:42:17 -0700154 }
swissChili23958ca2022-02-21 19:23:34 -0800155
swissChilid2af6ad2022-04-16 14:42:17 -0700156 ListView {
157 id: tipsList
158 anchors.left: sepRect.right
159 anchors.right: parent.right
160 anchors.top: textRefal.bottom
161 anchors.bottom: parent.bottom
162 anchors.bottomMargin: 16
163 anchors.topMargin: 6
164 anchors.leftMargin: 16
165 anchors.rightMargin: 36
166 spacing: 12
167
168 model: [
169 {url: "https://wiki.swisschili.sh/wiki/REFAL", title: "REFAL Studio Wiki"},
170 {url: "https://wiki.swisschili.sh/wiki/REFAL/Cookbook", title: "REFAL Cookbook"},
171 {url: "http://refal.botik.ru/book/html/", title: "REFAL-5 Programming Guide (en)"},
172 {url: "http://refal.net/rf5_frm.htm", title: "REFAL-5 Programming Guide (ru)"}
173 ]
174
175 delegate: Tip {
swissChili23958ca2022-02-21 19:23:34 -0800176 Layout.fillWidth: true
swissChili23958ca2022-02-21 19:23:34 -0800177
swissChilid2af6ad2022-04-16 14:42:17 -0700178 url: modelData.url
179 title: modelData.title
swissChili23958ca2022-02-21 19:23:34 -0800180
swissChilid2af6ad2022-04-16 14:42:17 -0700181 ToolTip.text: modelData.url
182 ToolTip.visible: containsMouse
183 ToolTip.delay: 1000
swissChili23958ca2022-02-21 19:23:34 -0800184 }
185 }
186}