Merge lp:~azzar1/unity/fix-1332509 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3833
Merged at revision: 3858
Proposed branch: lp:~azzar1/unity/fix-1332509
Merge into: lp:unity
Diff against target: 115 lines (+32/-0)
3 files modified
lockscreen/UserPromptView.cpp (+1/-0)
unity-shared/TextInput.cpp (+28/-0)
unity-shared/TextInput.h (+3/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1332509
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+223907@code.launchpad.net

Commit message

Add an arrow activator in the lockscreen.

To post a comment you must log in.
lp:~azzar1/unity/fix-1332509 updated
3833. By Andrea Azzarone on 2014-06-20

Add missing media file.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Cool, looks and works fine. The only thing is that probably the resource name should be better and it would be nice to ask tiheum an SVG version, so that we can eventually scale the lockscreen properly.

But this is fine from a general point of view.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/UserPromptView.cpp'
2--- lockscreen/UserPromptView.cpp 2014-06-07 16:26:51 +0000
3+++ lockscreen/UserPromptView.cpp 2014-06-20 12:25:33 +0000
4@@ -242,6 +242,7 @@
5 text_input->input_hint = SanitizeMessage(message);
6 text_input->hint_font_size = PROMPT_FONT_SIZE;
7 text_input->show_caps_lock = true;
8+ text_input->show_activator = true;
9 text_entry->SetPasswordMode(!visible);
10 text_entry->SetPasswordChar("•");
11 text_entry->SetToggleCursorVisibilityOnKeyFocus(true);
12
13=== added file 'resources/arrow_right.png'
14Binary files resources/arrow_right.png 1970-01-01 00:00:00 +0000 and resources/arrow_right.png 2014-06-20 12:25:33 +0000 differ
15=== modified file 'unity-shared/TextInput.cpp'
16--- unity-shared/TextInput.cpp 2014-04-23 16:49:25 +0000
17+++ unity-shared/TextInput.cpp 2014-06-20 12:25:33 +0000
18@@ -22,6 +22,7 @@
19 #include "unity-shared/DashStyle.h"
20 #include "unity-shared/RawPixel.h"
21 #include "unity-shared/PreviewStyle.h"
22+#include "unity-shared/TextureCache.h"
23
24 #include <X11/XKBlib.h>
25
26@@ -87,6 +88,7 @@
27 , input_hint("")
28 , hint_font_name(HINT_LABEL_DEFAULT_FONT_NAME)
29 , hint_font_size(HINT_LABEL_FONT_SIZE)
30+ , show_activator(false)
31 , show_caps_lock(false)
32 , bg_layer_(new nux::ColorLayer(nux::Color(0xff595853), true))
33 , caps_lock_on(false)
34@@ -127,6 +129,7 @@
35 layered_layout_->SetActiveLayerN(1);
36 layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
37
38+ // Caps lock warning
39 warning_ = new IconTexture(LoadWarningIcon(DEFAULT_ICON_SIZE));
40 warning_->SetVisible(caps_lock_on());
41 layout_->AddView(warning_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
42@@ -146,6 +149,20 @@
43 CheckIfCapsLockOn();
44 });
45
46+ // Activator
47+ activator_ = new IconTexture(LoadActivatorIcon(DEFAULT_ICON_SIZE));
48+ activator_->SetVisible(show_activator());
49+ layout_->AddView(activator_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
50+
51+ show_activator.changed.connect([this] (bool value) {
52+ activator_->SetVisible(value);
53+ });
54+
55+ activator_->mouse_click.connect([this](int, int, unsigned long, unsigned long) {
56+ pango_entry_->activated.emit();
57+ });
58+
59+ // Spinner
60 spinner_ = new SearchBarSpinner();
61 spinner_->SetVisible(false);
62 spinner_->SetMinMaxSize(22, 22);
63@@ -187,6 +204,11 @@
64 void TextInput::SetSpinnerVisible(bool visible)
65 {
66 spinner_->SetVisible(visible);
67+
68+ if (visible)
69+ activator_->SetVisible(false);
70+ else
71+ activator_->SetVisible(show_activator());
72 }
73
74 void TextInput::SetSpinnerState(SpinnerState spinner_state)
75@@ -199,6 +221,12 @@
76 hint_->SetFont((hint_font_name() + " " + std::to_string(hint_font_size())).c_str());
77 }
78
79+nux::ObjectPtr<nux::BaseTexture> TextInput::LoadActivatorIcon(int icon_size)
80+{
81+ TextureCache& cache = TextureCache::GetDefault();
82+ return cache.FindTexture("arrow_right.png", icon_size, icon_size);
83+}
84+
85 nux::ObjectPtr<nux::BaseTexture> TextInput::LoadWarningIcon(int icon_size)
86 {
87 auto* theme = gtk_icon_theme_get_default();
88
89=== modified file 'unity-shared/TextInput.h'
90--- unity-shared/TextInput.h 2014-04-23 16:49:25 +0000
91+++ unity-shared/TextInput.h 2014-06-20 12:25:33 +0000
92@@ -72,6 +72,7 @@
93 nux::Property<int> hint_font_size;
94 nux::ROProperty<bool> im_active;
95 nux::ROProperty<bool> im_preedit;
96+ nux::Property<bool> show_activator;
97 nux::Property<bool> show_caps_lock;
98
99 private:
100@@ -91,6 +92,7 @@
101 nux::Geometry GetWaringIconGeometry() const;
102 void CheckIfCapsLockOn();
103
104+ nux::ObjectPtr<nux::BaseTexture> LoadActivatorIcon(int icon_size);
105 nux::ObjectPtr<nux::BaseTexture> LoadWarningIcon(int icon_size);
106 void LoadWarningTooltip();
107
108@@ -126,6 +128,7 @@
109 bool mouse_over_warning_icon_;
110
111 IconTexture* warning_;
112+ IconTexture* activator_;
113 nux::ObjectPtr<nux::BaseTexture> warning_tooltip_;
114
115 glib::SignalManager sig_manager_;