diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-26 10:57:45 -0600 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-26 11:08:30 -0600 |
commit | c545b2e480d29d4a2149ca4cbadd84b6d23542e8 (patch) | |
tree | c54e59557c83a0e5bc6f2630cd8b42062a6b6edb | |
parent | 0527b2da9740862deb795768f8a6a6a3426faaab (diff) | |
download | kube-c545b2e480d29d4a2149ca4cbadd84b6d23542e8.tar.gz kube-c545b2e480d29d4a2149ca4cbadd84b6d23542e8.zip |
The account switcher is a control too
-rw-r--r-- | framework/qml/AbstractButton.qml | 10 | ||||
-rw-r--r-- | framework/qml/InlineAccountSwitcher.qml | 30 |
2 files changed, 18 insertions, 22 deletions
diff --git a/framework/qml/AbstractButton.qml b/framework/qml/AbstractButton.qml index 194812da..a964fe2f 100644 --- a/framework/qml/AbstractButton.qml +++ b/framework/qml/AbstractButton.qml | |||
@@ -24,6 +24,11 @@ import org.kube.framework 1.0 | |||
24 | T.Button { | 24 | T.Button { |
25 | id: root | 25 | id: root |
26 | 26 | ||
27 | property color color: Colors.buttonColor | ||
28 | property color textColor: Colors.textColor | ||
29 | property alias horizontalAlignment: label.horizontalAlignment | ||
30 | property alias verticalAlignment: label.verticalAlignment | ||
31 | |||
27 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | 32 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) |
28 | height: contentItem.implicitHeight + topPadding + bottomPadding | 33 | height: contentItem.implicitHeight + topPadding + bottomPadding |
29 | 34 | ||
@@ -35,8 +40,7 @@ T.Button { | |||
35 | hoverEnabled: true | 40 | hoverEnabled: true |
36 | Keys.onReturnPressed: root.clicked() | 41 | Keys.onReturnPressed: root.clicked() |
37 | 42 | ||
38 | property color color: Colors.buttonColor | 43 | font.family: Kube.Font.fontFamily |
39 | property color textColor: Colors.textColor | ||
40 | 44 | ||
41 | background: Rectangle { | 45 | background: Rectangle { |
42 | color: root.color | 46 | color: root.color |
@@ -64,10 +68,12 @@ T.Button { | |||
64 | } | 68 | } |
65 | 69 | ||
66 | contentItem: Label { | 70 | contentItem: Label { |
71 | id: label | ||
67 | text: root.text | 72 | text: root.text |
68 | elide: Text.ElideRight | 73 | elide: Text.ElideRight |
69 | horizontalAlignment: Text.AlignHCenter | 74 | horizontalAlignment: Text.AlignHCenter |
70 | verticalAlignment: Text.AlignVCenter | 75 | verticalAlignment: Text.AlignVCenter |
71 | color: root.textColor | 76 | color: root.textColor |
77 | font: root.font | ||
72 | } | 78 | } |
73 | } | 79 | } |
diff --git a/framework/qml/InlineAccountSwitcher.qml b/framework/qml/InlineAccountSwitcher.qml index 67d88637..ae1d0dc7 100644 --- a/framework/qml/InlineAccountSwitcher.qml +++ b/framework/qml/InlineAccountSwitcher.qml | |||
@@ -55,32 +55,22 @@ FocusScope { | |||
55 | height: Kube.Units.gridUnit | 55 | height: Kube.Units.gridUnit |
56 | Layout.fillHeight: isCurrent | 56 | Layout.fillHeight: isCurrent |
57 | 57 | ||
58 | Rectangle { | 58 | Kube.TextButton { |
59 | id: accountLabel | 59 | id: accountLabel |
60 | 60 | anchors.top: parent.top | |
61 | anchors.left: parent.left | ||
61 | height: Kube.Units.gridUnit | 62 | height: Kube.Units.gridUnit |
62 | width: parent.width | 63 | width: parent.width |
63 | 64 | ||
64 | color: Kube.Colors.textColor | 65 | textColor: Kube.Colors.highlightedTextColor |
65 | activeFocusOnTab: !isCurrent | 66 | activeFocusOnTab: !isCurrent |
66 | Keys.onReturnPressed: { | 67 | onClicked: root.currentAccount = model.accountId |
67 | root.currentAccount = model.accountId | 68 | text: model.name |
68 | } | 69 | font.weight: Font.Bold |
70 | font.family: Kube.Font.fontFamily | ||
71 | horizontalAlignment: Text.AlignHLeft | ||
72 | padding: 0 | ||
69 | 73 | ||
70 | MouseArea { | ||
71 | anchors.fill: parent | ||
72 | onClicked: { | ||
73 | root.currentAccount = model.accountId | ||
74 | } | ||
75 | } | ||
76 | |||
77 | Kube.Label{ | ||
78 | anchors.verticalCenter: parent.verticalCenter | ||
79 | text: model.name | ||
80 | font.weight: Font.Bold | ||
81 | color: Kube.Colors.highlightedTextColor | ||
82 | font.underline: accountLabel.activeFocus | ||
83 | } | ||
84 | } | 74 | } |
85 | 75 | ||
86 | Kube.FolderListView { | 76 | Kube.FolderListView { |