Debian Codegraph @

src/qml/System.qml

raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 import QtQuick 2.15
5 import QtQuick.Controls 2.15
6 import QtQuick.Layouts 1.15
7 import CoreCtrl.UIComponents 1.0
8 import "Style.js" as Style
9
10 Page {
11 hoverEnabled: Style.g_hover
12
13 SYSTEM_INFO {
14 id: systemInfo
15 objectName: "SYSTEM_INFO"
16
17 onAddSystemInfo: (componentName, info) => p.newInfoComponent(componentName, info)
18 }
19
20 QtObject {
21 id: p
22
23 function newInfoComponent(componentName, info) {
24 var tab = tabBtnComponent.createObject(tabBar)
25 tab.text = componentName
26 tabBar.addItem(tab)
27
28 var infoPane = infoPaneComponent.createObject(infoPages)
29 infoPane.addInfo(info)
30 }
31 }
32
33 Component {
34 id: infoPaneComponent
35
36 InfoPane {}
37 }
38
39 Component {
40 id: tabBtnComponent
41
42 CTabButton {}
43 }
44
45 SettingsDialog {
46 id: settingsDlg
47 }
48
49 ColumnLayout {
50 spacing: 0
51 anchors.fill: parent
52
53 TabBar {
54 id: tabBar
55 Layout.fillWidth: true
56
57 Component.onCompleted: {
58 var aboutTab = tabBtnComponent.createObject(tabBar)
59 aboutTab.text = appInfo.name
60 tabBar.addItem(aboutTab)
61 }
62 }
63
64 StackLayout {
65 id: infoPages
66 currentIndex: tabBar.currentIndex
67
68 About {}
69 }
70 }
71
72 header: ToolBar {
73 RowLayout {
74 anchors.fill: parent
75
76 Label {
77 text: qsTr("Information and application settings...")
78 leftPadding: 10
79 color: Style.ToolBar.text_color_msg
80 }
81
82 Rectangle {
83 Layout.fillWidth: true
84 }
85
86 ToolButton {
87 text: qsTr("Settings")
88 visible: tabBar.currentIndex === 0
89 onClicked: settingsDlg.open()
90 }
91
92 ToolButton {
93 text: qsTr("Copy all")
94 visible: tabBar.currentIndex > 0
95 onClicked: systemInfo.copyToClipboard()
96 }
97 }
98 }
99 }