Merge lp:~alecu/unity-scope-click/fix-empty-preview into lp:unity-scope-click/devel

Proposed by Alejandro J. Cura
Status: Merged
Approved by: dobey
Approved revision: 423
Merged at revision: 426
Proposed branch: lp:~alecu/unity-scope-click/fix-empty-preview
Merge into: lp:unity-scope-click/devel
Diff against target: 113 lines (+20/-11)
5 files modified
libclickscope/click/download-manager.cpp (+1/-1)
libclickscope/click/preview.cpp (+13/-8)
libclickscope/click/preview.h (+2/-0)
libclickscope/click/webclient.cpp (+2/-1)
libclickscope/tests/test_preview.cpp (+2/-1)
To merge this branch: bzr merge lp:~alecu/unity-scope-click/fix-empty-preview
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
dobey (community) Approve
Review via email: mp+231943@code.launchpad.net

Commit message

Do not push preview widgets until all data is available

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
420. By Alejandro J. Cura

Fix existing unit tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
421. By Alejandro J. Cura

More debugging

422. By Alejandro J. Cura

Move captured vars from closure to object attributes

423. By Alejandro J. Cura

Clean up of debugging messages

Revision history for this message
dobey (dobey) wrote :

Looks ok to me, and seems to solve the issue at hand, in testing the branch under unity-scope-tool.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libclickscope/click/download-manager.cpp'
--- libclickscope/click/download-manager.cpp 2014-08-21 14:29:45 +0000
+++ libclickscope/click/download-manager.cpp 2014-08-26 15:16:39 +0000
@@ -313,7 +313,7 @@
313 }313 }
314 qDebug() << "Found object path" << QString::fromStdString(object_path)314 qDebug() << "Found object path" << QString::fromStdString(object_path)
315 << "for package" << QString::fromStdString(package_name);315 << "for package" << QString::fromStdString(package_name);
316 if (downloads.size() != 1) {316 if (downloads.size() > 1) {
317 qWarning() << "More than one download with the same object path";317 qWarning() << "More than one download with the same object path";
318 }318 }
319 callback(object_path);319 callback(object_path);
320320
=== modified file 'libclickscope/click/preview.cpp'
--- libclickscope/click/preview.cpp 2014-08-21 17:11:08 +0000
+++ libclickscope/click/preview.cpp 2014-08-26 15:16:39 +0000
@@ -336,6 +336,7 @@
336 header.add_attribute_value("mascot", scopes::Variant(details.package.icon_url));336 header.add_attribute_value("mascot", scopes::Variant(details.package.icon_url));
337 widgets.push_back(header);337 widgets.push_back(header);
338338
339 qDebug() << "Pushed widgets for package:" << QString::fromStdString(details.package.title);
339 return widgets;340 return widgets;
340}341}
341342
@@ -822,6 +823,7 @@
822 : PreviewStrategy(result, client),823 : PreviewStrategy(result, client),
823 DepartmentUpdater(depts), nam(nam)824 DepartmentUpdater(depts), nam(nam)
824{825{
826 qDebug() << "Creating new UninstalledPreview for result" << QString::fromStdString(result["name"].get_string());
825}827}
826828
827UninstalledPreview::~UninstalledPreview()829UninstalledPreview::~UninstalledPreview()
@@ -833,26 +835,29 @@
833 qDebug() << "in UninstalledPreview::run, about to populate details";835 qDebug() << "in UninstalledPreview::run, about to populate details";
834 populateDetails([this, reply](const PackageDetails &details){836 populateDetails([this, reply](const PackageDetails &details){
835 store_department(details);837 store_department(details);
838 found_details = details;
836 std::string app_name = result["name"].get_string();839 std::string app_name = result["name"].get_string();
837 get_downloader(nam)->get_download_progress(app_name,840 get_downloader(nam)->get_download_progress(app_name,
838 [this, reply, details](std::string object_path){841 [this, reply](std::string object_path){
839 scopes::PreviewWidgetList button_widgets;842 found_object_path = object_path;
840 if(object_path.empty()) {
841 button_widgets = uninstalledActionButtonWidgets(details);
842 } else {
843 button_widgets = progressBarWidget(object_path);
844 }
845 pushPackagePreviewWidgets(reply, details, button_widgets);
846 });843 });
847 },844 },
848 [this, reply](const ReviewList& reviewlist,845 [this, reply](const ReviewList& reviewlist,
849 click::Reviews::Error error) {846 click::Reviews::Error error) {
847 scopes::PreviewWidgetList button_widgets;
848 if(found_object_path.empty()) {
849 button_widgets = uninstalledActionButtonWidgets(found_details);
850 } else {
851 button_widgets = progressBarWidget(found_object_path);
852 }
853 pushPackagePreviewWidgets(reply, found_details, button_widgets);
850 if (error == click::Reviews::Error::NoError) {854 if (error == click::Reviews::Error::NoError) {
851 reply->push(reviewsWidgets(reviewlist));855 reply->push(reviewsWidgets(reviewlist));
852 } else {856 } else {
853 qDebug() << "There was an error getting reviews for:" << result["name"].get_string().c_str();857 qDebug() << "There was an error getting reviews for:" << result["name"].get_string().c_str();
854 }858 }
855 reply->finished();859 reply->finished();
860 qDebug() << "---------- Finished reply for:" << result["name"].get_string().c_str();
856 });861 });
857}862}
858863
859864
=== modified file 'libclickscope/click/preview.h'
--- libclickscope/click/preview.h 2014-08-21 14:29:45 +0000
+++ libclickscope/click/preview.h 2014-08-26 15:16:39 +0000
@@ -256,6 +256,8 @@
256256
257 void run(unity::scopes::PreviewReplyProxy const& reply) override;257 void run(unity::scopes::PreviewReplyProxy const& reply) override;
258protected:258protected:
259 PackageDetails found_details;
260 std::string found_object_path;
259 virtual click::Downloader* get_downloader(const QSharedPointer<click::network::AccessManager>& nam);261 virtual click::Downloader* get_downloader(const QSharedPointer<click::network::AccessManager>& nam);
260 virtual scopes::PreviewWidgetList uninstalledActionButtonWidgets(const PackageDetails &details);262 virtual scopes::PreviewWidgetList uninstalledActionButtonWidgets(const PackageDetails &details);
261};263};
262264
=== modified file 'libclickscope/click/webclient.cpp'
--- libclickscope/click/webclient.cpp 2014-08-11 15:16:18 +0000
+++ libclickscope/click/webclient.cpp 2014-08-26 15:16:39 +0000
@@ -172,7 +172,8 @@
172void click::web::Response::replyFinished()172void click::web::Response::replyFinished()
173{173{
174 auto response = reply->readAll();174 auto response = reply->readAll();
175 qDebug() << "got response" << response.toPercentEncoding(" ");175 qDebug() << "Response for: " << request->url();
176 qDebug() << response.toPercentEncoding(" ");
176 emit finished(response);177 emit finished(response);
177}178}
178179
179180
=== modified file 'libclickscope/tests/test_preview.cpp'
--- libclickscope/tests/test_preview.cpp 2014-08-21 17:11:08 +0000
+++ libclickscope/tests/test_preview.cpp 2014-08-26 15:16:39 +0000
@@ -275,9 +275,10 @@
275 }275 }
276276
277 void populateDetails(std::function<void (const click::PackageDetails &)> details_callback,277 void populateDetails(std::function<void (const click::PackageDetails &)> details_callback,
278 std::function<void (const click::ReviewList &, click::Reviews::Error)> /*reviews_callback*/) {278 std::function<void (const click::ReviewList &, click::Reviews::Error)> reviews_callback) {
279 click::PackageDetails details;279 click::PackageDetails details;
280 details_callback(details);280 details_callback(details);
281 reviews_callback({}, click::Reviews::Error::NoError);
281 }282 }
282 MOCK_METHOD1(uninstalledActionButtonWidgets, scopes::PreviewWidgetList (const click::PackageDetails &details));283 MOCK_METHOD1(uninstalledActionButtonWidgets, scopes::PreviewWidgetList (const click::PackageDetails &details));
283 MOCK_METHOD1(progressBarWidget, scopes::PreviewWidgetList(const std::string& object_path));284 MOCK_METHOD1(progressBarWidget, scopes::PreviewWidgetList(const std::string& object_path));

Subscribers

People subscribed via source and target branches

to all changes: