diff options
| author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-08-09 12:30:47 +0100 |
|---|---|---|
| committer | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-08-09 12:30:47 +0100 |
| commit | 6cf45df19fe18eb794cd02c65e74777cc78151ca (patch) | |
| tree | 30fc752f34cf91c541c6b46ecb6811d118da39e6 /dash | |
| parent | df352ec6711f69e0cd0b5a0923a554513094543d (diff) | |
Updated previews to use PreLayoutManagement to set max sizes instead of ComputeContentSize
(bzr r2419.4.50)
Diffstat (limited to 'dash')
| -rw-r--r-- | dash/previews/ApplicationPreview.cpp | 14 | ||||
| -rw-r--r-- | dash/previews/ApplicationPreview.h | 2 | ||||
| -rw-r--r-- | dash/previews/GenericPreview.cpp | 13 | ||||
| -rw-r--r-- | dash/previews/GenericPreview.h | 2 | ||||
| -rw-r--r-- | dash/previews/MoviePreview.cpp | 13 | ||||
| -rw-r--r-- | dash/previews/MoviePreview.h | 2 | ||||
| -rw-r--r-- | dash/previews/MusicPreview.cpp | 26 | ||||
| -rw-r--r-- | dash/previews/MusicPreview.h | 2 | ||||
| -rw-r--r-- | dash/previews/PreviewInfoHintWidget.cpp | 6 | ||||
| -rw-r--r-- | dash/previews/PreviewInfoHintWidget.h | 2 | ||||
| -rw-r--r-- | dash/previews/Track.cpp | 4 | ||||
| -rw-r--r-- | dash/previews/Track.h | 2 |
12 files changed, 31 insertions, 57 deletions
diff --git a/dash/previews/ApplicationPreview.cpp b/dash/previews/ApplicationPreview.cpp index 74371117a..61ca8d3fe 100644 --- a/dash/previews/ApplicationPreview.cpp +++ b/dash/previews/ApplicationPreview.cpp @@ -305,10 +305,9 @@ void ApplicationPreview::SetupViews() SetLayout(image_data_layout); } -long ApplicationPreview::ComputeContentSize() +void ApplicationPreview::PreLayoutManagement() { nux::Geometry geo = GetGeometry(); - GetLayout()->SetGeometry(geo); previews::Style& style = dash::previews::Style::Instance(); @@ -316,10 +315,7 @@ long ApplicationPreview::ComputeContentSize() if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth()) geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth()); - image_->SetGeometry(geo_art); - - full_data_layout_->SetGeometry(nux::Geometry(geo_art.x + geo_art.width + style.GetPanelSplitWidth(), geo.y, - geo.width - geo_art.width - style.GetPanelSplitWidth(), geo.height)); + image_->SetMinMaxSize(geo_art.width, geo_art.height); int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin()); int top_app_info_max_width = details_width - style.GetAppIconAreaWidth() - style.GetSpaceBetweenIconAndDetails(); @@ -336,13 +332,9 @@ long ApplicationPreview::ComputeContentSize() button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight()); } - image_->ComputeContentSize(); - full_data_layout_->ComputeContentSize(); - - return nux::eCompliantHeight | nux::eCompliantWidth; + Preview::PreLayoutManagement(); } - } // namespace previews } // namespace dash } // namepsace unity diff --git a/dash/previews/ApplicationPreview.h b/dash/previews/ApplicationPreview.h index 3ee3b2744..d2756420f 100644 --- a/dash/previews/ApplicationPreview.h +++ b/dash/previews/ApplicationPreview.h @@ -61,7 +61,7 @@ public: protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long ComputeContentSize(); + virtual void PreLayoutManagement(); void SetupBackground(); void SetupViews(); diff --git a/dash/previews/GenericPreview.cpp b/dash/previews/GenericPreview.cpp index ef3898ecd..7578b2b65 100644 --- a/dash/previews/GenericPreview.cpp +++ b/dash/previews/GenericPreview.cpp @@ -232,10 +232,9 @@ void GenericPreview::SetupViews() SetLayout(image_data_layout); } -long GenericPreview::ComputeContentSize() +void GenericPreview::PreLayoutManagement() { nux::Geometry geo = GetGeometry(); - GetLayout()->SetGeometry(geo); previews::Style& style = dash::previews::Style::Instance(); @@ -243,10 +242,7 @@ long GenericPreview::ComputeContentSize() if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth()) geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth()); - image_->SetGeometry(geo_art); - - full_data_layout_->SetGeometry(nux::Geometry(geo_art.x + geo_art.width + style.GetPanelSplitWidth(), geo.y, - geo.width - geo_art.width - style.GetPanelSplitWidth(), geo.height)); + image_->SetMinMaxSize(geo_art.width, geo_art.height); int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin()); @@ -259,10 +255,7 @@ long GenericPreview::ComputeContentSize() button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight()); } - image_->ComputeContentSize(); - full_data_layout_->ComputeContentSize(); - - return nux::eCompliantHeight | nux::eCompliantWidth; + Preview::PreLayoutManagement(); } diff --git a/dash/previews/GenericPreview.h b/dash/previews/GenericPreview.h index 73fe52141..01b0e57a8 100644 --- a/dash/previews/GenericPreview.h +++ b/dash/previews/GenericPreview.h @@ -58,7 +58,7 @@ public: protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long ComputeContentSize(); + virtual void PreLayoutManagement(); void SetupBackground(); void SetupViews(); diff --git a/dash/previews/MoviePreview.cpp b/dash/previews/MoviePreview.cpp index 7eafd2e29..7154284d0 100644 --- a/dash/previews/MoviePreview.cpp +++ b/dash/previews/MoviePreview.cpp @@ -254,10 +254,9 @@ void MoviePreview::SetupView() } -long MoviePreview::ComputeContentSize() +void MoviePreview::PreLayoutManagement() { nux::Geometry geo = GetGeometry(); - GetLayout()->SetGeometry(geo); previews::Style& style = dash::previews::Style::Instance(); @@ -265,10 +264,7 @@ long MoviePreview::ComputeContentSize() if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth()) geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth()); - image_->SetGeometry(geo_art); - - full_data_layout_->SetGeometry(nux::Geometry(geo_art.x + geo_art.width + style.GetPanelSplitWidth(), geo.y, - geo.width - geo_art.width - style.GetPanelSplitWidth(), geo.height)); + image_->SetMinMaxSize(geo_art.width, geo_art.height); int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin()); @@ -281,10 +277,7 @@ long MoviePreview::ComputeContentSize() button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight()); } - image_->ComputeContentSize(); - full_data_layout_->ComputeContentSize(); - - return nux::eCompliantHeight | nux::eCompliantWidth; + Preview::PreLayoutManagement(); } } // namespace previews diff --git a/dash/previews/MoviePreview.h b/dash/previews/MoviePreview.h index bc4b39872..9f983e2fe 100644 --- a/dash/previews/MoviePreview.h +++ b/dash/previews/MoviePreview.h @@ -58,7 +58,7 @@ public: protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long ComputeContentSize(); + virtual void PreLayoutManagement(); virtual void OnNavigateOut(); virtual void OnNavigateInComplete(); diff --git a/dash/previews/MusicPreview.cpp b/dash/previews/MusicPreview.cpp index d865240ee..ba0dd1ed1 100644 --- a/dash/previews/MusicPreview.cpp +++ b/dash/previews/MusicPreview.cpp @@ -265,7 +265,7 @@ void MusicPreview::OnPauseTrack(std::string const& uri) music_preview_model->PauseUri(uri); } -long MusicPreview::ComputeContentSize() +void MusicPreview::PreLayoutManagement() { nux::Geometry geo = GetGeometry(); GetLayout()->SetGeometry(geo); @@ -276,25 +276,21 @@ long MusicPreview::ComputeContentSize() if (geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() < style.GetDetailsPanelMinimumWidth()) geo_art.width = MAX(0, geo.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin() - style.GetDetailsPanelMinimumWidth()); - image_->SetGeometry(geo_art); + image_->SetMinMaxSize(geo_art.width, geo_art.height); - full_data_layout_->SetGeometry(nux::Geometry(geo_art.x + geo_art.width + style.GetPanelSplitWidth(), geo.y, - geo.width - geo_art.width - style.GetPanelSplitWidth(), geo.height)); + full_data_layout_->SetMinMaxSize(geo.width - geo_art.width - style.GetPanelSplitWidth(), geo.height); - int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin()); + // int details_width = MAX(0, geo.width - geo_art.width - style.GetPanelSplitWidth() - style.GetDetailsLeftMargin() - style.GetDetailsRightMargin()); - if (title_) { title_->SetMaximumWidth(details_width); } - if (subtitle_) { subtitle_->SetMaximumWidth(details_width); } + // if (title_) { title_->SetMaximumWidth(details_width); } + // if (subtitle_) { subtitle_->SetMaximumWidth(details_width); } - for (nux::AbstractButton* button : action_buttons_) - { - button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight()); - } - - image_->ComputeContentSize(); - full_data_layout_->ComputeContentSize(); + // for (nux::AbstractButton* button : action_buttons_) + // { + // button->SetMinMaxSize(CLAMP((details_width - style.GetSpaceBetweenActions()) / 2, 0, style.GetActionButtonMaximumWidth()), style.GetActionButtonHeight()); + // } - return nux::eCompliantHeight | nux::eCompliantWidth; + Preview::PreLayoutManagement(); } } diff --git a/dash/previews/MusicPreview.h b/dash/previews/MusicPreview.h index ddfac4bac..7566b6a94 100644 --- a/dash/previews/MusicPreview.h +++ b/dash/previews/MusicPreview.h @@ -59,7 +59,7 @@ public: protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual long ComputeContentSize(); + virtual void PreLayoutManagement(); void SetupBackground(); void SetupViews(); diff --git a/dash/previews/PreviewInfoHintWidget.cpp b/dash/previews/PreviewInfoHintWidget.cpp index 6368ec8fd..447bc3f55 100644 --- a/dash/previews/PreviewInfoHintWidget.cpp +++ b/dash/previews/PreviewInfoHintWidget.cpp @@ -208,11 +208,11 @@ void PreviewInfoHintWidget::SetupViews() } -long PreviewInfoHintWidget::ComputeContentSize() +void PreviewInfoHintWidget::PreLayoutManagement() { previews::Style& style = previews::Style::Instance(); nux::Geometry const& geo = GetGeometry(); - + for (InfoHint const& info_hint : info_hints_) { int max_info_value_width = geo.width; @@ -238,7 +238,7 @@ long PreviewInfoHintWidget::ComputeContentSize() info_hint.second->SetMaximumWidth(max_info_value_width); } - return View::ComputeContentSize(); + View::PreLayoutManagement(); } diff --git a/dash/previews/PreviewInfoHintWidget.h b/dash/previews/PreviewInfoHintWidget.h index 2a77b4343..ad7b3eadf 100644 --- a/dash/previews/PreviewInfoHintWidget.h +++ b/dash/previews/PreviewInfoHintWidget.h @@ -56,7 +56,7 @@ public: std::string GetName() const; void AddProperties(GVariantBuilder* builder); - long ComputeContentSize(); + void PreLayoutManagement(); protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); diff --git a/dash/previews/Track.cpp b/dash/previews/Track.cpp index b29127b33..2edc1ec35 100644 --- a/dash/previews/Track.cpp +++ b/dash/previews/Track.cpp @@ -374,7 +374,7 @@ void Track::UpdateTrackState() } -long Track::ComputeContentSize() +void Track::PreLayoutManagement() { previews::Style& style = previews::Style::Instance(); nux::Geometry const& geo = GetGeometry(); @@ -384,7 +384,7 @@ long Track::ComputeContentSize() title_->SetMaximumWidth(GetGeometry().width - geo.height - style.GetMusicDurationWidth() - layout_spacing*2); - return View::ComputeContentSize(); + View::PreLayoutManagement(); } diff --git a/dash/previews/Track.h b/dash/previews/Track.h index 4a77f0384..554de51bc 100644 --- a/dash/previews/Track.h +++ b/dash/previews/Track.h @@ -64,7 +64,7 @@ public: protected: virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw); - virtual long ComputeContentSize(); + virtual void PreLayoutManagement(); void SetupBackground(); void SetupViews(); |
