Merge lp:~3v1n0/unity/neko-reloaded into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4227
Proposed branch: lp:~3v1n0/unity/neko-reloaded
Merge into: lp:unity
Diff against target: 170 lines (+50/-6)
6 files modified
dash/DashView.cpp (+24/-0)
dash/DashView.h (+1/-0)
dash/ResultRendererTile.cpp (+17/-4)
dash/ResultRendererTile.h (+3/-1)
dash/ScopeView.cpp (+4/-1)
dash/ScopeView.h (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/neko-reloaded
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Ted Gould (community) Approve
Charles Kerr (community) Approve
Brandon Schaefer (community) Approve
Omer Akram (community) qa Approve
Neil J. Patel (community) Approve
Gord Allott (community) best review Approve
Iain Lane Approve
Review via email: mp+322219@code.launchpad.net

Commit message

Dash: fix the neko regression we have since a couple of cycles

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

Yep!

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

you star

review: Approve (best review)
Revision history for this message
Neil J. Patel (njpatel) wrote :

Excellent work!

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks "fathers", it means a lot! :-D

PS: Yeah, launcher is missing, too bad it was FF coming.

Revision history for this message
Omer Akram (om26er) wrote :

Works as expected, I must add.

review: Approve (qa)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Im sorry we had to remove this from U7, must approve

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

You guys rock, thanks for all the hard work you've put into this.

Revision history for this message
Charles Kerr (charlesk) wrote :

This is the only remaining feature we needed. Guys, we can all go home now

review: Approve
Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
Michal Hruby (mhr3) wrote :

😱 oh dear, how did I miss this? Definitely 👍

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/DashView.cpp'
--- dash/DashView.cpp 2016-07-04 16:53:41 +0000
+++ dash/DashView.cpp 2017-04-07 18:30:29 +0000
@@ -122,6 +122,7 @@
122 , last_activated_timestamp_(0)122 , last_activated_timestamp_(0)
123 , activate_on_finish_(false)123 , activate_on_finish_(false)
124 , visible_(false)124 , visible_(false)
125 , neko_mode_(false)
125 , opening_column_x_(-1)126 , opening_column_x_(-1)
126 , opening_row_y_(-1)127 , opening_row_y_(-1)
127 , opening_column_width_(0)128 , opening_column_width_(0)
@@ -138,6 +139,10 @@
138 QueueDraw();139 QueueDraw();
139 });140 });
140141
142 gsize tmp_sz;
143 glib::String neko((gchar*)g_base64_decode("VU5JVFlfTkVLTw==", &tmp_sz));
144 neko_mode_ = g_getenv(neko) != nullptr;
145
141 SetupViews();146 SetupViews();
142 SetupUBusConnections();147 SetupUBusConnections();
143 AddChild(overlay_window_buttons_.GetPointer());148 AddChild(overlay_window_buttons_.GetPointer());
@@ -1290,6 +1295,7 @@
1290 nux::ObjectPtr<ScopeView> view(new ScopeView(scope, search_bar_->show_filters()));1295 nux::ObjectPtr<ScopeView> view(new ScopeView(scope, search_bar_->show_filters()));
1291 AddChild(view.GetPointer());1296 AddChild(view.GetPointer());
1292 view->scale = scale();1297 view->scale = scale();
1298 view->neko_mode = neko_mode_;
1293 view->SetVisible(false);1299 view->SetVisible(false);
1294 view->result_activated.connect(sigc::mem_fun(this, &DashView::OnResultActivated));1300 view->result_activated.connect(sigc::mem_fun(this, &DashView::OnResultActivated));
12951301
@@ -1427,6 +1433,24 @@
1427{1433{
1428 if (active_scope_view_.IsValid())1434 if (active_scope_view_.IsValid())
1429 {1435 {
1436 const std::array<const gchar*, 2> nekos = {
1437 "d2VsY29tZSBiYWNrIHVuaXR5=",
1438 "ZmFyZXdlbGwgdW5pdHk=",
1439 };
1440
1441 for (unsigned i = 0; i < nekos.size(); ++i)
1442 {
1443 gsize tmp_sz;
1444 glib::String neko((gchar*)g_base64_decode(nekos[i], &tmp_sz));
1445 if (search_bar_->search_string() == neko.Str())
1446 {
1447 for (auto const& view : scope_views_)
1448 view.second->neko_mode = (i != 0);
1449
1450 return;
1451 }
1452 }
1453
1430 if (!activate_delay_ && !search_bar_->in_live_search())1454 if (!activate_delay_ && !search_bar_->in_live_search())
1431 active_scope_view_->ActivateFirst();1455 active_scope_view_->ActivateFirst();
1432 else1456 else
14331457
=== modified file 'dash/DashView.h'
--- dash/DashView.h 2016-03-17 07:36:44 +0000
+++ dash/DashView.h 2017-04-07 18:30:29 +0000
@@ -175,6 +175,7 @@
175 bool activate_on_finish_;175 bool activate_on_finish_;
176 glib::Source::UniquePtr activate_delay_;176 glib::Source::UniquePtr activate_delay_;
177 bool visible_;177 bool visible_;
178 bool neko_mode_;
178179
179 nux::ObjectPtr<nux::IOpenGLBaseTexture> dash_view_copy_;180 nux::ObjectPtr<nux::IOpenGLBaseTexture> dash_view_copy_;
180 nux::ObjectPtr<nux::IOpenGLBaseTexture> search_view_copy_;181 nux::ObjectPtr<nux::IOpenGLBaseTexture> search_view_copy_;
181182
=== modified file 'dash/ResultRendererTile.cpp'
--- dash/ResultRendererTile.cpp 2016-02-09 18:16:51 +0000
+++ dash/ResultRendererTile.cpp 2017-04-07 18:30:29 +0000
@@ -90,8 +90,9 @@
9090
91NUX_IMPLEMENT_OBJECT_TYPE(ResultRendererTile);91NUX_IMPLEMENT_OBJECT_TYPE(ResultRendererTile);
9292
93ResultRendererTile::ResultRendererTile(NUX_FILE_LINE_DECL)93ResultRendererTile::ResultRendererTile(NUX_FILE_LINE_DECL, bool neko_mode)
94 : ResultRenderer(NUX_FILE_LINE_PARAM)94 : ResultRenderer(NUX_FILE_LINE_PARAM)
95 , neko_mode_(neko_mode)
95{96{
96 UpdateWidthHeight();97 UpdateWidthHeight();
97 scale.changed.connect([this] (double) { UpdateWidthHeight(); });98 scale.changed.connect([this] (double) { UpdateWidthHeight(); });
@@ -271,9 +272,21 @@
271 int tile_gsize = style.GetTileGIconSize().CP(scale);272 int tile_gsize = style.GetTileGIconSize().CP(scale);
272273
273 std::string const& icon_hint = row.icon_hint;274 std::string const& icon_hint = row.icon_hint;
274 std::string const& icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;275 std::string icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;
275276
276 glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), NULL));277 if (neko_mode_)
278 {
279 const std::array<const gchar*, 2> pool = {
280 "aHR0cDovL3BsYWNla2l0dGVuLmNvbS9nLyVpLyVpLw==",
281 "aHR0cDovL3BsYWNla2l0dGVuLmNvbS8laS8laS8=",
282 };
283 gsize tmp0;
284 int tmp1 = tile_size - (rand() % RawPixel(16).CP(scale));
285 glib::String tmp2((gchar*)g_base64_decode(pool[rand() % pool.size()], &tmp0));
286 icon_name = glib::String(g_strdup_printf(tmp2, tmp1, tmp1)).Str();
287 }
288
289 glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), nullptr));
277 TextureContainer* container = row.renderer<TextureContainer*>();290 TextureContainer* container = row.renderer<TextureContainer*>();
278291
279 if (container)292 if (container)
280293
=== modified file 'dash/ResultRendererTile.h'
--- dash/ResultRendererTile.h 2015-10-03 01:08:12 +0000
+++ dash/ResultRendererTile.h 2017-04-07 18:30:29 +0000
@@ -59,7 +59,7 @@
59public:59public:
60 NUX_DECLARE_OBJECT_TYPE(ResultRendererTile, ResultRenderer);60 NUX_DECLARE_OBJECT_TYPE(ResultRendererTile, ResultRenderer);
6161
62 ResultRendererTile(NUX_FILE_LINE_PROTO);62 ResultRendererTile(NUX_FILE_LINE_PROTO, bool neko_mode = false);
63 virtual ~ResultRendererTile() {}63 virtual ~ResultRendererTile() {}
6464
65 virtual void Render(nux::GraphicsEngine& GfxContext,65 virtual void Render(nux::GraphicsEngine& GfxContext,
@@ -95,6 +95,8 @@
95 int width, int height);95 int width, int height);
9696
97 void UpdateWidthHeight();97 void UpdateWidthHeight();
98
99 bool neko_mode_;
98};100};
99101
100}102}
101103
=== modified file 'dash/ScopeView.cpp'
--- dash/ScopeView.cpp 2015-12-09 12:46:58 +0000
+++ dash/ScopeView.cpp 2017-04-07 18:30:29 +0000
@@ -143,6 +143,7 @@
143, filters_expanded(false)143, filters_expanded(false)
144, can_refine_search(false)144, can_refine_search(false)
145, scale(DEFAULT_SCALE)145, scale(DEFAULT_SCALE)
146, neko_mode(false)
146, scope_(scope)147, scope_(scope)
147, no_results_active_(false)148, no_results_active_(false)
148, last_good_filter_model_(-1)149, last_good_filter_model_(-1)
@@ -172,6 +173,8 @@
172 conn_manager_.Add(scope_->filters.changed.connect(sigc::mem_fun(this, &ScopeView::SetupFilters)));173 conn_manager_.Add(scope_->filters.changed.connect(sigc::mem_fun(this, &ScopeView::SetupFilters)));
173 SetupFilters(scope->filters);174 SetupFilters(scope->filters);
174175
176 neko_mode.changed.connect([this] (bool) { SetupCategories(scope_->categories); });
177
175 scope_->connected.changed.connect([this](bool is_connected)178 scope_->connected.changed.connect([this](bool is_connected)
176 {179 {
177 // We need to search again if we were reconnected after being connected before.180 // We need to search again if we were reconnected after being connected before.
@@ -485,7 +488,7 @@
485 }488 }
486 else489 else
487 {490 {
488 results_view->SetModelRenderer(new ResultRendererTile(NUX_TRACKER_LOCATION));491 results_view->SetModelRenderer(new ResultRendererTile(NUX_TRACKER_LOCATION, neko_mode()));
489 }492 }
490493
491 if (scope_)494 if (scope_)
492495
=== modified file 'dash/ScopeView.h'
--- dash/ScopeView.h 2015-11-06 18:11:30 +0000
+++ dash/ScopeView.h 2017-04-07 18:30:29 +0000
@@ -72,6 +72,7 @@
72 nux::Property<ScopeViewType> view_type;72 nux::Property<ScopeViewType> view_type;
73 nux::Property<bool> can_refine_search;73 nux::Property<bool> can_refine_search;
74 nux::Property<double> scale;74 nux::Property<double> scale;
75 nux::Property<bool> neko_mode;
7576
76 sigc::signal<void, ResultView::ActivateType, LocalResult const&, GVariant*, std::string const&> result_activated;77 sigc::signal<void, ResultView::ActivateType, LocalResult const&, GVariant*, std::string const&> result_activated;
7778