on xenial help sign in
left+right indicator labels
817b7c3Nick Dedekind
Panel/Indicators/DefaultIndicatorWidget2.qml+17−4
@@ -26,7 +26,8 @@ Indicators.IndicatorWidget {
26
26
27 width: itemRow.width + units.gu(0.7)
27 width: itemRow.width + units.gu(0.7)
28
28
29− property alias label: itemLabel.text
29+ property alias leftLabel: itemLeftLabel.text
30+ property alias rightLabel: itemRightLabel.text
30 property var icons: undefined
31 property var icons: undefined
31
32
32 Row {
33 Row {
@@ -39,6 +40,17 @@ Indicators.IndicatorWidget {
39 }
40 }
40 spacing: units.gu(0.5)
41 spacing: units.gu(0.5)
41
42
43+ Label {
44+ id: itemLeftLabel
45+ objectName: "leftLabel"
46+ color: Theme.palette.selected.backgroundText
47+ opacity: 0.8
48+ font.family: "Ubuntu"
49+ fontSize: "medium"
50+ anchors.verticalCenter: parent.verticalCenter
51+ visible: text != ""
52+ }
53+
42 Row {
54 Row {
43 width: childrenRect.width
55 width: childrenRect.width
44 anchors {
56 anchors {
@@ -63,8 +75,8 @@ Indicators.IndicatorWidget {
63 }
75 }
64
76
65 Label {
77 Label {
66− id: itemLabel
78+ id: itemRightLabel
67− objectName: "itemLabel"
79+ objectName: "rightLabel"
68 color: Theme.palette.selected.backgroundText
80 color: Theme.palette.selected.backgroundText
69 opacity: 0.8
81 opacity: 0.8
70 font.family: "Ubuntu"
82 font.family: "Ubuntu"
@@ -82,7 +94,8 @@ Indicators.IndicatorWidget {
82 return;
94 return;
83 }
95 }
84
96
97+ leftLabel = actionState.leftLabel;
85− label = actionState.label;
98+ rightLabel = actionState.rightLabel;
86 icons = actionState.icons;
99 icons = actionState.icons;
87 enabled = actionState.visible;
100 enabled = actionState.visible;
88 }
101 }
plugins/Unity/Indicators/rootactionstate.cpp+13−6
@@ -108,7 +108,14 @@ bool RootActionState::isValid() const
108 return m_menu && m_menu->rowCount() > 0;
108 return m_menu && m_menu->rowCount() > 0;
109}
109}
110
110
111−QString RootActionState::label() const
111+QString RootActionState::leftLabel() const
112+{
113+ if (!isValid()) return QString();
114+
115+ return m_cachedState.value("pre-label", QVariant::fromValue(QString())).toString();
116+}
117+
118+QString RootActionState::rightLabel() const
112{
119{
113 if (!isValid()) return QString();
120 if (!isValid()) return QString();
114
121
@@ -126,7 +133,7 @@ QString RootActionState::accessibleName() const
126{
133{
127 if (!isValid()) return QString();
134 if (!isValid()) return QString();
128
135
129− return m_cachedState.value("accessible-name", QVariant::fromValue(QString())).toString();
136+ return m_cachedState.value("accessible-desc", QVariant::fromValue(QString())).toString();
130}
137}
131
138
132bool RootActionState::isVisible() const
139bool RootActionState::isVisible() const
@@ -204,7 +211,7 @@ QVariant RootActionState::toQVariant(GVariant* state) const
204 // FIXME - should be sending a url.
211 // FIXME - should be sending a url.
205 GIcon *gicon = g_icon_deserialize (vvalue);
212 GIcon *gicon = g_icon_deserialize (vvalue);
206 if (gicon) {
213 if (gicon) {
207− icons << iconUri(gicon) << iconUri(gicon);
214+ icons << iconUri(gicon);
208 }
215 }
209 qmap.insert("icons", icons);
216 qmap.insert("icons", icons);
210
217
@@ -221,7 +228,7 @@ QVariant RootActionState::toQVariant(GVariant* state) const
221 // FIXME - should be sending a url.
228 // FIXME - should be sending a url.
222 GIcon *gicon = g_icon_deserialize (child);
229 GIcon *gicon = g_icon_deserialize (child);
223 if (gicon) {
230 if (gicon) {
224− icons << iconUri(gicon) << iconUri(gicon);
231+ icons << iconUri(gicon);
225 g_object_unref (gicon);
232 g_object_unref (gicon);
226 }
233 }
227 g_variant_unref(child);
234 g_variant_unref(child);
@@ -252,12 +259,12 @@ QVariant RootActionState::toQVariant(GVariant* state) const
252 &visible);
259 &visible);
253
260
254 qmap["label"] = label ? QString::fromUtf8(label) : "";
261 qmap["label"] = label ? QString::fromUtf8(label) : "";
255− qmap["accessible-name"] = accessible_name ? QString::fromUtf8(accessible_name) : "";
262+ qmap["accessible-desc"] = accessible_name ? QString::fromUtf8(accessible_name) : "";
256 qmap["visible"] = visible;
263 qmap["visible"] = visible;
257
264
258 gicon = g_icon_new_for_string (icon, NULL);
265 gicon = g_icon_new_for_string (icon, NULL);
259 if (gicon) {
266 if (gicon) {
260− qmap["icons"] = QStringList() << iconUri(gicon) << iconUri(gicon);
267+ qmap["icons"] = QStringList() << iconUri(gicon);
261 g_object_unref (gicon);
268 g_object_unref (gicon);
262 }
269 }
263
270
plugins/Unity/Indicators/rootactionstate.h+6−3
@@ -32,7 +32,8 @@ class UNITYINDICATORS_EXPORT RootActionState : public ActionStateParser
32 Q_PROPERTY(UnityMenuModel* menu READ menu WRITE setMenu NOTIFY menuChanged)
32 Q_PROPERTY(UnityMenuModel* menu READ menu WRITE setMenu NOTIFY menuChanged)
33
33
34 Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
34 Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
35− Q_PROPERTY(QString label READ label NOTIFY labelChanged)
35+ Q_PROPERTY(QString leftLabel READ leftLabel NOTIFY leftLabelChanged)
36+ Q_PROPERTY(QString rightLabel READ rightLabel NOTIFY rightLabelChanged)
36 Q_PROPERTY(QStringList icons READ icons NOTIFY iconsChanged)
37 Q_PROPERTY(QStringList icons READ icons NOTIFY iconsChanged)
37 Q_PROPERTY(QString accessibleName READ accessibleName NOTIFY accessibleNameChanged)
38 Q_PROPERTY(QString accessibleName READ accessibleName NOTIFY accessibleNameChanged)
38 Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
39 Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
@@ -47,7 +48,8 @@ public:
47 void setIndex(int index);
48 void setIndex(int index);
48
49
49 bool isValid() const;
50 bool isValid() const;
50− QString label() const;
51+ QString leftLabel() const;
52+ QString rightLabel() const;
51 QStringList icons() const;
53 QStringList icons() const;
52 QString accessibleName() const;
54 QString accessibleName() const;
53 bool isVisible() const;
55 bool isVisible() const;
@@ -62,7 +64,8 @@ Q_SIGNALS:
62 void indexChanged();
64 void indexChanged();
63
65
64 void validChanged();
66 void validChanged();
65− void labelChanged();
67+ void leftLabelChanged();
68+ void rightLabelChanged();
66 void iconsChanged();
69 void iconsChanged();
67 void accessibleNameChanged();
70 void accessibleNameChanged();
68 void visibleChanged();
71 void visibleChanged();