diff options
| author | Gord Allott <gord.allott@canonical.com> | 2012-08-09 17:12:30 +0100 |
|---|---|---|
| committer | Gord Allott <gord.allott@canonical.com> | 2012-08-09 17:12:30 +0100 |
| commit | c4fbcd22522676fadf016c1f569d2d31aee03ab1 (patch) | |
| tree | bbc37c4d441ef6b5b9ce7f1b859e2327ef837d3f | |
| parent | bd6c6a018dac5847c20973400702a57b512c5e6d (diff) | |
fixes for new preview ui branch
(bzr r2419.6.18)
| -rw-r--r-- | dash/DashView.cpp | 8 | ||||
| -rw-r--r-- | dash/PreviewStateMachine.cpp | 10 | ||||
| -rw-r--r-- | dash/PreviewStateMachine.h | 2 | ||||
| -rw-r--r-- | dash/ResultViewGrid.cpp | 6 | ||||
| -rw-r--r-- | dash/StandaloneDash.cpp | 2 | ||||
| -rw-r--r-- | dash/previews/StandaloneMusicPreview.cpp | 4 |
6 files changed, 19 insertions, 13 deletions
diff --git a/dash/DashView.cpp b/dash/DashView.cpp index f039b5fd7..0b60e3839 100644 --- a/dash/DashView.cpp +++ b/dash/DashView.cpp @@ -131,7 +131,7 @@ void DashView::ClosePreview() void DashView::BuildPreview(Preview::Ptr model) { - LOG_DEBUG(logger) << "building preview..."; + LOG_DEBUG(logger) << "building preview...: " << model->preview_uri(); if (!preview_displaying_) { preview_container_ = previews::PreviewContainer::Ptr(new previews::PreviewContainer()); @@ -148,11 +148,13 @@ void DashView::BuildPreview(Preview::Ptr model) preview_displaying_ = true; preview_container_->navigate_left.connect([&] () { + preview_state_machine_.Reset(); preview_navigation_mode_ = previews::Navigation::LEFT; ubus_manager_.SendMessage(UBUS_DASH_PREVIEW_NAVIGATION_REQUEST, g_variant_new("(iss)", -1, stored_preview_uri_identifier_.c_str(), stored_preview_unique_id_.c_str())); }); preview_container_->navigate_right.connect([&] () { + preview_state_machine_.Reset(); preview_navigation_mode_ = previews::Navigation::RIGHT; ubus_manager_.SendMessage(UBUS_DASH_PREVIEW_NAVIGATION_REQUEST, g_variant_new("(iss)", 1, stored_preview_uri_identifier_.c_str(), stored_preview_unique_id_.c_str())); }); @@ -368,10 +370,6 @@ nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo) void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw) { renderer_.DrawFull(gfx_context, content_geo_, GetAbsoluteGeometry(), GetGeometry()); - if (preview_displaying_ && preview_container_) - { - preview_container_->ProcessDraw(gfx_context, force_draw); - } } void DashView::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw) diff --git a/dash/PreviewStateMachine.cpp b/dash/PreviewStateMachine.cpp index 4d4543390..be82808a3 100644 --- a/dash/PreviewStateMachine.cpp +++ b/dash/PreviewStateMachine.cpp @@ -56,11 +56,17 @@ void PreviewStateMachine::ActivatePreview(Preview::Ptr preview) requires_activation_ = true; } -void PreviewStateMachine::ClosePreview() +void PreviewStateMachine::Reset() { - stored_preview_ = nullptr; left_results = -1; right_results = -1; + stored_preview_ = nullptr; + requires_activation_ = true; +} + +void PreviewStateMachine::ClosePreview() +{ + stored_preview_ = nullptr; preview_active = true; SetSplitPosition(SplitPosition::CONTENT_AREA, -1); } diff --git a/dash/PreviewStateMachine.h b/dash/PreviewStateMachine.h index 71ed52ff6..1652c1583 100644 --- a/dash/PreviewStateMachine.h +++ b/dash/PreviewStateMachine.h @@ -44,6 +44,7 @@ public: ~PreviewStateMachine(); void ActivatePreview(Preview::Ptr preview); // potentially async call. + void Reset(); // resets the state but does not close the preview void ClosePreview(); void SetSplitPosition(SplitPosition position, int coord); @@ -64,6 +65,7 @@ private: Preview::Ptr stored_preview_; bool requires_activation_; + bool requires_new_position_; }; } diff --git a/dash/ResultViewGrid.cpp b/dash/ResultViewGrid.cpp index 443e3aad2..751e84a3b 100644 --- a/dash/ResultViewGrid.cpp +++ b/dash/ResultViewGrid.cpp @@ -138,12 +138,14 @@ ResultViewGrid::ResultViewGrid(NUX_FILE_LINE_DECL) } else { - LOG_DEBUG(logger) << "activating preview for index: " << current_index; + activated_uri_ = GetUriForIndex(current_index); + LOG_DEBUG(logger) << "activating preview for index: " + << "(" << current_index << ")" + << " " << activated_uri_; int left_results = current_index; int right_results = (results_.size()) ? (results_.size() - current_index) - 1 : 0; ubus_.SendMessage(UBUS_DASH_PREVIEW_INFO_PAYLOAD, g_variant_new("(iii)", 0, left_results, right_results)); - activated_uri_ = GetUriForIndex(current_index); UriActivated.emit(activated_uri_, ActivateType::PREVIEW); } } diff --git a/dash/StandaloneDash.cpp b/dash/StandaloneDash.cpp index 108b79293..cbc38743c 100644 --- a/dash/StandaloneDash.cpp +++ b/dash/StandaloneDash.cpp @@ -31,6 +31,7 @@ #include "DashView.h" #include "unity-shared/UnitySettings.h" #include "unity-shared/DashStyle.h" +#include "unity-shared/ThumbnailGenerator.h" #define WIDTH 1024 #define HEIGHT 768 @@ -89,6 +90,7 @@ int main(int argc, char **argv) nux::NuxInitialize(0); nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY")); // The instances for the pseudo-singletons. + unity::ThumbnailGenerator thumb_generator; unity::Settings settings; unity::dash::Style dash_style; diff --git a/dash/previews/StandaloneMusicPreview.cpp b/dash/previews/StandaloneMusicPreview.cpp index 19c749a19..c4f62d11d 100644 --- a/dash/previews/StandaloneMusicPreview.cpp +++ b/dash/previews/StandaloneMusicPreview.cpp @@ -156,10 +156,6 @@ TestRunner::TestRunner (std::string const& search_string) results_->result_added.connect([&](Result const& result) { previews::Navigation navDisabled = previews::Navigation::BOTH; - if (nav_iter < results_->count.Get()) - navDisabled = previews::Navigation( (unsigned int)results_ & ~((unsigned int)previews::Navigation::RIGHT)); - if (results_->count.Get() > 0 && nav_iter > 0) - navDisabled = previews::Navigation( (unsigned int)results_ & ~((unsigned int)previews::Navigation::LEFT)); if (first_) { |
