~mefrio-g/ubuntu-clock-app/fix-1272470

« back to all changes in this revision

Viewing changes to common/SettingsPage.qml

  • Committer: Tarmac
  • Author(s): Nekhelesh Ramananthan
  • Date: 2014-01-13 12:23:30 UTC
  • mfrom: (287.1.10 settings-page)
  • Revision ID: tarmac-20140113122330-8hlcpf8ow5p3yb5t
- Add settings page to expose the setting to switch between 12/24 hour format
- Used u1db to store these settings
- Clock and Alarms Page respect these settings. Fixes: https://bugs.launchpad.net/bugs/1268158.

Approved by Ubuntu Phone Apps Jenkins Bot, Riccardo Padovani.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import Ubuntu.Components 0.1
 
3
import Ubuntu.Components.ListItems 0.1 as ListItem
 
4
 
 
5
Page {
 
6
    id: settingsPage
 
7
 
 
8
    visible: false
 
9
    title: i18n.tr("Settings")
 
10
 
 
11
    Column {
 
12
        id: mainColumn
 
13
 
 
14
        spacing: units.gu(2)
 
15
        anchors {
 
16
            fill: parent
 
17
            margins: units.gu(2)
 
18
        }
 
19
 
 
20
        OptionSelector {
 
21
            id: timeFormat
 
22
            text: "Time Format"
 
23
            model: ["12-hour", "24-hour"]
 
24
            selectedIndex: appSetting.contents.timeFormat === "12-hour" ? 0 : 1
 
25
            onSelectedIndexChanged: {
 
26
                var settings = appSetting.contents
 
27
                settings.timeFormat = selectedIndex === 0 ? "12-hour" : "24-hour"
 
28
                appSetting.contents = settings
 
29
            }
 
30
        }
 
31
 
 
32
        OptionSelector {
 
33
            id: timeStyle
 
34
            text: "Style"
 
35
            model: ["Analogue", "Digital"]
 
36
            opacity: 0.5
 
37
            enabled: false
 
38
            selectedIndex: appSetting.contents.style === "analogue" ? 0 : 1
 
39
            onSelectedIndexChanged: {
 
40
                var settings = appSetting.contents
 
41
                settings.style = selectedIndex === 0 ? "analogue" : "digital"
 
42
                appSetting.contents = settings
 
43
            }
 
44
        }
 
45
    }
 
46
}