~jonas-drange/ubuntu-system-settings/hwKeyboardMinimal

« back to all changes in this revision

Viewing changes to plugins/mouse/PrimaryButtonSelector.qml

  • Committer: jonas-drange
  • Date: 2016-01-25 15:33:26 UTC
  • mfrom: (1576.1.7 ubuntu-system-settings)
  • Revision ID: jonas.drange@canonical.com-20160125153326-eh8masqxjb14feyl
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of system-settings
 
3
 *
 
4
 * Copyright (C) 2015 Canonical Ltd.
 
5
 *
 
6
 * Contact: Ken VanDine <ken.vandine@canonical.com>
 
7
 *
 
8
 * This program is free software: you can redistribute it and/or modify it
 
9
 * under the terms of the GNU General Public License version 3, as published
 
10
 * by the Free Software Foundation.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful, but
 
13
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
14
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
15
 * PURPOSE.  See the GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License along
 
18
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 */
 
20
 
 
21
import QtQuick 2.0
 
22
import SystemSettings 1.0
 
23
import Ubuntu.Components 1.3
 
24
import Ubuntu.Components.ListItems 1.3 as ListItem
 
25
 
 
26
Column {
 
27
    property var buttonEnum
 
28
 
 
29
    Binding {
 
30
        target: primaryLeftCheck
 
31
        property: "checked"
 
32
        value: (buttonEnum === "Left") ? true : false
 
33
    }
 
34
 
 
35
    Binding {
 
36
        target: primaryRightCheck
 
37
        property: "checked"
 
38
        value: (buttonEnum === "Right") ? true : false
 
39
    }
 
40
 
 
41
    SettingsItemTitle {
 
42
        text: i18n.tr("Primary button:")
 
43
        showDivider: false
 
44
    }
 
45
 
 
46
    ListItem.Empty {
 
47
        anchors { 
 
48
            left: parent.left
 
49
            right: parent.right
 
50
            leftMargin: units.gu(2)
 
51
            rightMargin: units.gu(2)
 
52
        }
 
53
        showDivider: false
 
54
        highlightWhenPressed: false
 
55
        height: itemRow.height
 
56
        Row {
 
57
            id: itemRow
 
58
            spacing: units.gu(2)
 
59
            Row {
 
60
                spacing: units.gu(1)
 
61
                CheckBox {
 
62
                    id: primaryLeftCheck
 
63
                    onTriggered: {
 
64
                        if (checked)
 
65
                            buttonEnum = "Left"
 
66
                        else
 
67
                            checked = true;
 
68
                    }
 
69
                }
 
70
                Label {
 
71
                    height: primaryLeftCheck.height
 
72
                    verticalAlignment: Text.AlignVCenter
 
73
                    text: i18n.tr("Left")
 
74
                }
 
75
            }
 
76
            Row {
 
77
                spacing: units.gu(1)
 
78
                CheckBox {
 
79
                    id: primaryRightCheck
 
80
                    onTriggered: {
 
81
                        if (checked)
 
82
                            buttonEnum = "Right"
 
83
                        else
 
84
                            checked = true;
 
85
                    }
 
86
                }
 
87
                Label {
 
88
                    height: primaryRightCheck.height
 
89
                    verticalAlignment: Text.AlignVCenter
 
90
                    text: i18n.tr("Right")
 
91
                }
 
92
            }
 
93
        }
 
94
    }
 
95
}