ArtikulateDrawer.qml 4.26 KB
Newer Older
1
2
3
/*
 *  Copyright 2018  Andreas Cord-Landwehr <cordlandwehr@kde.org>
 *
4
 *  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5
6
7
8
9
 */

import QtQuick 2.5
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0 as QQC2
10
import org.kde.kirigami 2.7 as Kirigami
11
import artikulate 1.0
12
13
14
15
16
17
18
19
20
21
22
23
24
25

Kirigami.GlobalDrawer {
    id: root

    title: "Artikulate"
    titleIcon: "artikulate"
    resetMenuOnTriggered: false
    bottomPadding: 0
    property QtObject pageStack

    // enforce drawer always to be open
    modal: false
    handleVisible: false

26
27
28
29
30
31
32
33
34
35
36
37
38
39
    topContent: [
        ColumnLayout {
            spacing: 0
            Layout.fillWidth: true
            Layout.leftMargin: -root.leftPadding
            Layout.rightMargin: -root.rightPadding
            ActionListItem {
                action: Kirigami.Action {
                    text: i18n("Training")
                    iconName: "artikulate"
                    onTriggered: {
                        root.pageStack.clear();
                        root.pageStack.push(welcomePageComponent);
                    }
40
41
                }
            }
42
43
            Kirigami.Separator {
                Layout.fillWidth: true
44
45
46
47
            }
        }
    ]

48
    // ordinary Kirigami actions are filled from training units/phrases
49
    actions: sessionActions.actions
50
    DrawerTrainingActions {
51
        id: sessionActions
52
        session: g_trainingSession
53
        onTriggerPhraseView: {
54
55
56
57
            root.pageStack.clear();
            root.pageStack.push(trainingPageComponent);
        }
    }
58
59
60
61
62
63
    Connections {
        target: g_trainingSession
        onCloseUnit: {
            root.resetMenu()
        }
    }
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

//TODO integrate again
//     [
//         Kirigami.Action {
//             text: i18n("Help")
//             iconName: "help-about"
//             Kirigami.Action {
//                 text: i18n("Artikulate Handbook")
//                 iconName: "help-contents"
//                 onTriggered: {
//                     triggerAction("help_contents");
//                     globalDrawer.resetMenu();
//                 }
//             }
//             Kirigami.Action {
//                 text: i18n("Report Bug")
//                 iconName: "tools-report-bug"
//                 onTriggered: {
//                     triggerAction("help_report_bug");
//                     globalDrawer.resetMenu();
//                 }
//             }
//             Kirigami.Action {
//                 text: i18n("About KDE")
//                 iconName: "help-about"
//                 onTriggered: {
//                     triggerAction("help_about_kde")
//                     globalDrawer.resetMenu();
//                 }
//             }
//         }
//     ]

97
98
99
100
101
102
103
104
105
106
    ColumnLayout {
        spacing: 0
        Layout.fillWidth: true
        Layout.leftMargin: -root.leftPadding
        Layout.rightMargin: -root.rightPadding

        Kirigami.Separator {
            Layout.fillWidth: true
        }

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//TODO currently disabled while contents have to be ported
//        ActionListItem {
//            action: Kirigami.Action {
//                text: i18n("Statistics")
//                iconName: "user-properties"
//                onTriggered: {
//                    root.pageStack.pop();
//                    root.pageStack.push(profileSettingsPageComponent);
//                }
//            }
//        }
//        ActionListItem {
//            action: Kirigami.Action {
//                text: i18n("Settings")
//                iconName: "settings-configure"
//                onTriggered: triggerSettingsDialog()
//            }
//        }
125
126
127
128
        ActionListItem {
            action: Kirigami.Action {
                text: i18n("Download Training")
                iconName: "get-hot-new-stuff"
129
130
131
132
                onTriggered: {
                    root.pageStack.pop();
                    root.pageStack.push(downloadPageComponent);
                }
133
134
            }
        }
135
136
        ActionListItem {
            action: Kirigami.Action {
Nicolas Fella's avatar
Nicolas Fella committed
137
                text: i18n("About Artikulate")
138
139
                iconName: "help-about"
                onTriggered: {
Nicolas Fella's avatar
Nicolas Fella committed
140
141
142
                    if (root.pageStack.layers.depth < 2) {
                        root.pageStack.layers.push(aboutPageComponent)
                    }
143
144
145
                }
            }
        }
146
147
    }
}