2
* Copyright 2015 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
import Ubuntu.Components 1.3
22
title: "Ubuntu UI Toolkit"
26
flickable: layout.columns === 1 ? widgetList : null
27
trailingActionBar.actions: [
29
text: i18n.tr('Right to Left')
32
onTriggered: gallery.rtl = !gallery.rtl
35
text: i18n.tr('Left to Right')
38
onTriggered: gallery.rtl = !gallery.rtl
41
text: i18n.tr('Use dark theme')
43
visible: gallery.theme.name == 'Ubuntu.Components.Themes.Ambiance'
44
onTriggered: gallery.theme.name = 'Ubuntu.Components.Themes.SuruDark'
47
text: i18n.tr('Use light theme')
49
visible: gallery.theme.name == 'Ubuntu.Components.Themes.SuruDark'
50
onTriggered: gallery.theme.name = 'Ubuntu.Components.Themes.Ambiance'
53
text: i18n.tr('About')
55
onTriggered: mainPage.pageStack.addPageToCurrentColumn(mainPage, Qt.resolvedUrl("About.qml"))
58
text: i18n.tr("Deactivate mouse")
59
iconName: "non-starred"
60
visible: QuickUtils.mouseAttached
61
onTriggered: QuickUtils.mouseAttached = false
64
text: i18n.tr("Activate mouse")
66
visible: !QuickUtils.mouseAttached
67
onTriggered: QuickUtils.mouseAttached = true
73
if (layout.columns < 2) {
74
widgetList.currentIndex = -1;
77
widgetList.openPage();
83
objectName: "widgetList"
86
topMargin: mainPage.header.flickable ? 0 : mainPage.header.height
89
model: WidgetsModel {}
92
onCurrentIndexChanged: openPage()
95
if (!mainPage.active || currentIndex < 0) return;
96
var modelData = model.get(currentIndex);
97
var source = Qt.resolvedUrl(modelData.source);
98
mainPage.pageStack.addPageToNextColumn(mainPage, source, {title: modelData.label});
102
objectName: model.objectName
104
anchors.leftMargin: units.gu(2)
105
anchors.rightMargin: units.gu(2)
107
enabled: source != ""
109
property string text: label
110
onClicked: widgetList.currentIndex = index
115
rightMargin: units.gu(4)
118
verticalAlignment: Text.AlignVCenter
125
verticalCenter: parent.verticalCenter
130
highlight: Rectangle {
131
color: theme.palette.selected.background
133
highlightMoveDuration: 0
137
flickable: widgetList
138
text: i18n.tr('About')
140
onClicked: mainPage.pageStack.addPageToCurrentColumn(mainPage, Qt.resolvedUrl("About.qml"))