| 1 |
/* |
| 2 |
* Copyright (C) 2016 Canonical Ltd |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License version 3 as |
| 6 |
* published by the Free Software Foundation. |
| 7 |
* |
| 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 General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Authored by: Florian Boucault <[email protected]> |
| 17 |
*/ |
| 18 |
|
| 19 |
import QtQuick 2.4 |
| 20 |
import Lomiri.Components 1.3 |
| 21 |
|
| 22 |
Page { |
| 23 |
id: settingsPage |
| 24 |
objectName: "settingsPage" |
| 25 |
|
| 26 |
implicitWidth: units.gu(60) |
| 27 |
implicitHeight: units.gu(80) |
| 28 |
property color windowColor: currentSection.windowColor |
| 29 |
|
| 30 |
header: PageHeader { |
| 31 |
leadingActionBar.actions: [ |
| 32 |
Action { |
| 33 |
text: i18n.tr("close") |
| 34 |
iconName: "back" |
| 35 |
onTriggered: settingsLoader.active = false |
| 36 |
} |
| 37 |
] |
| 38 |
|
| 39 |
title: i18n.tr("Preferences") |
| 40 |
flickable: currentSection && currentSection.flickableItem ? |
| 41 |
currentSection.flickableItem : null |
| 42 |
StyleHints { |
| 43 |
backgroundColor: theme.palette.normal.overlay |
| 44 |
} |
| 45 |
|
| 46 |
property var selectedAction: sections.actions[sections.selectedIndex] |
| 47 |
sections { |
| 48 |
actions: [ |
| 49 |
Action { |
| 50 |
text: i18n.tr("Interface") |
| 51 |
property string source: Qt.resolvedUrl("SettingsInterfaceSection.qml") |
| 52 |
}, |
| 53 |
Action { |
| 54 |
text: i18n.tr("Shortcuts") |
| 55 |
property string source: Qt.resolvedUrl("SettingsShortcutsSection.qml") |
| 56 |
} |
| 57 |
] |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
property SettingsSection currentSection: sectionLoader.item ? sectionLoader.item : null |
| 62 |
Loader { |
| 63 |
id: sectionLoader |
| 64 |
anchors { |
| 65 |
top: currentSection.flickableItem ? parent.top : settingsPage.header.bottom |
| 66 |
bottom: parent.bottom |
| 67 |
left: parent.left |
| 68 |
right: parent.right |
| 69 |
} |
| 70 |
source: settingsPage.header.selectedAction.source |
| 71 |
focus: true |
| 72 |
} |
| 73 |
} |