Merge lp:~macslow/unity/unity.fix-863240 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1841
Proposed branch: lp:~macslow/unity/unity.fix-863240
Merge into: lp:unity
Diff against target: 126 lines (+46/-14)
2 files modified
plugins/unityshell/src/DashSearchBar.cpp (+40/-14)
plugins/unityshell/src/DashSearchBar.h (+6/-0)
To merge this branch: bzr merge lp:~macslow/unity/unity.fix-863240
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Andrea Cimitan (community) Abstain
Review via email: mp+88213@code.launchpad.net

Description of the change

Fixes the position, alignment, spacing and arrow-artwork for the "Filter results". See...

http://people.canonical.com/~mmueller/fix-863240.png

To post a comment you must log in.
Revision history for this message
Andrea Cimitan (cimi) wrote :

The arrow should be moved few pixels below... At least comparing your screenshot with https://launchpadlibrarian.net/81538790/file_lens_filters.png

review: Needs Fixing
Revision history for this message
Mirco Müller (macslow) wrote :

> The arrow should be moved few pixels below... At least comparing your
> screenshot with https://launchpadlibrarian.net/81538790/file_lens_filters.png

That's not possible with nux' layout right now.

Revision history for this message
Andrea Cimitan (cimi) wrote :

So we can merge it, but keep the bug opened (In progress) until it is fixed. Or we need workarounds... but we can't deliver all those imperfections in 12.04

Revision history for this message
Mirco Müller (macslow) wrote :

> So we can merge it, but keep the bug opened (In progress) until it is fixed.
> Or we need workarounds... but we can't deliver all those imperfections in
> 12.04

I fixed the position with an insane nested nux-layout solution just for the arrow... and got Jay to agree on my request for extending nux' layout API with an pixel-offset ability. But that's something which will not happen right away. So we can just use my current work-around for the position-fix.

Revision history for this message
Andrea Cimitan (cimi) wrote :

I am fine with the visual changes then, you should do the same for the "see more lines..." issue as well (definitely!!!).
On the code side, waiting for a unity dev. What I can say is that you should add a small comment like FIXME just to remember *why* you did that and when you plan to remove that code (so when Nux will feature what we want).

And you added one blank line in the last header file, not sure if that's wanted!

Cheers, thx!

Revision history for this message
Andrea Cimitan (cimi) :
review: Abstain
Revision history for this message
Andrea Cimitan (cimi) wrote :

tested, it is close to the right edge here... doesn-t look like in your screenshot

Revision history for this message
Gord Allott (gordallott) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashSearchBar.cpp'
2--- plugins/unityshell/src/DashSearchBar.cpp 2012-01-16 15:19:01 +0000
3+++ plugins/unityshell/src/DashSearchBar.cpp 2012-01-17 15:01:26 +0000
4@@ -22,6 +22,7 @@
5 #include <Nux/Nux.h>
6 #include <Nux/BaseWindow.h>
7 #include <Nux/HLayout.h>
8+#include <Nux/VLayout.h>
9 #include <Nux/Layout.h>
10 #include <Nux/WindowCompositor.h>
11
12@@ -44,6 +45,8 @@
13 #define LIVE_SEARCH_TIMEOUT 40
14 #define SPINNER_TIMEOUT 100
15
16+static const float kExpandDefaultIconOpacity = 1.0f;
17+
18 namespace unity
19 {
20 namespace dash
21@@ -94,23 +97,42 @@
22 layered_layout_->SetActiveLayerN(1);
23 layered_layout_->SetMinimumWidth(search_bar_width_);
24 layered_layout_->SetMaximumWidth(search_bar_width_);
25- layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
26+ layout_->AddView(layered_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
27
28- std::string filter_str = _("Filter results");
29- filter_str+= " ▸";
30+ std::string filter_str = _("<b>Filter results</b>");
31 show_filters_ = new nux::StaticCairoText(filter_str.c_str());
32 show_filters_->SetVisible(false);
33 show_filters_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
34 show_filters_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);
35 show_filters_->mouse_click.connect([&] (int x, int y, unsigned long b, unsigned long k) { showing_filters = !showing_filters; });
36
37+ nux::BaseTexture* arrow;
38+ arrow = dash::Style::Instance().GetGroupExpandIcon();
39+ expand_icon_ = new IconTexture(arrow,
40+ arrow->GetWidth(),
41+ arrow->GetHeight());
42+ expand_icon_->SetOpacity(kExpandDefaultIconOpacity);
43+ expand_icon_->SetMinimumSize(arrow->GetWidth(), arrow->GetHeight());
44+ expand_icon_->SetVisible(false);
45+ expand_icon_->mouse_click.connect([&] (int x, int y, unsigned long b, unsigned long k) { showing_filters = !showing_filters; });
46+
47 filter_layout_ = new nux::HLayout();
48- filter_layout_->SetHorizontalExternalMargin(12);
49- filter_space_ = new nux::SpaceLayout(0, 10000, 0, 1);
50+ filter_layout_->SetHorizontalInternalMargin(8);
51+ filter_layout_->SetHorizontalExternalMargin(6);
52+ filter_space_ = new nux::SpaceLayout(100, 10000, 0, 1);
53 filter_layout_->AddLayout(filter_space_, 1);
54- filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_RIGHT);
55-
56- layout_->AddView(filter_layout_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FIX);
57+ filter_layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_CENTER);
58+
59+ arrow_layout_ = new nux::VLayout();
60+ arrow_top_space_ = new nux::SpaceLayout(2, 2, 12, 12);
61+ arrow_bottom_space_ = new nux::SpaceLayout(2, 2, 8, 8);
62+ arrow_layout_->AddView(arrow_top_space_, 0, nux::MINOR_POSITION_CENTER);
63+ arrow_layout_->AddView(expand_icon_, 0, nux::MINOR_POSITION_CENTER);
64+ arrow_layout_->AddView(arrow_bottom_space_, 0, nux::MINOR_POSITION_CENTER);
65+
66+ filter_layout_->AddView(arrow_layout_, 0, nux::MINOR_POSITION_CENTER);
67+
68+ layout_->AddView(filter_layout_, 1, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FULL);
69
70 sig_manager_.Add(new Signal<void, GtkSettings*, GParamSpec*>
71 (gtk_settings_get_default(),
72@@ -123,7 +145,11 @@
73 search_string.SetSetterFunction(sigc::mem_fun(this, &SearchBar::set_search_string));
74 im_active.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_im_active));
75 showing_filters.changed.connect(sigc::mem_fun(this, &SearchBar::OnShowingFiltersChanged));
76- can_refine_search.changed.connect([&] (bool can_refine) { show_filters_->SetVisible(can_refine); });
77+ can_refine_search.changed.connect([&] (bool can_refine)
78+ {
79+ show_filters_->SetVisible(can_refine);
80+ expand_icon_->SetVisible(can_refine);
81+ });
82 }
83
84 SearchBar::~SearchBar()
85@@ -229,11 +255,11 @@
86
87 void SearchBar::OnShowingFiltersChanged(bool is_showing)
88 {
89- std::string filter_str = _("Filter results");
90- filter_str += " <small>";
91- filter_str += is_showing ? "▾" : "▸";
92- filter_str += "</small>";
93- show_filters_->SetText(filter_str.c_str());
94+ dash::Style& style = dash::Style::Instance();
95+ if (is_showing)
96+ expand_icon_->SetTexture(style.GetGroupUnexpandIcon());
97+ else
98+ expand_icon_->SetTexture(style.GetGroupExpandIcon());
99 }
100
101 void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
102
103=== modified file 'plugins/unityshell/src/DashSearchBar.h'
104--- plugins/unityshell/src/DashSearchBar.h 2012-01-16 15:19:01 +0000
105+++ plugins/unityshell/src/DashSearchBar.h 2012-01-17 15:01:26 +0000
106@@ -33,6 +33,7 @@
107 #include <UnityCore/GLibSignal.h>
108
109 #include "DashSearchBarSpinner.h"
110+#include "IconTexture.h"
111 #include "IMTextEntry.h"
112 #include "Introspectable.h"
113 #include "StaticCairoText.h"
114@@ -103,8 +104,13 @@
115 nux::HLayout* filter_layout_;
116 nux::SpaceLayout* filter_space_;
117 nux::StaticCairoText* show_filters_;
118+ nux::VLayout* arrow_layout_;
119+ nux::SpaceLayout* arrow_top_space_;
120+ nux::SpaceLayout* arrow_bottom_space_;
121+ IconTexture* expand_icon_;
122 int search_bar_width_;
123
124+
125 int last_width_;
126 int last_height_;
127