Merge lp:~townsend/unity/unity.refactor-preview into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3006
Proposed branch: lp:~townsend/unity/unity.refactor-preview
Merge into: lp:unity
Diff against target: 567 lines (+36/-152)
12 files modified
dash/previews/ApplicationPreview.cpp (+0/-8)
dash/previews/ApplicationPreview.h (+1/-21)
dash/previews/GenericPreview.cpp (+0/-8)
dash/previews/GenericPreview.h (+1/-24)
dash/previews/MoviePreview.cpp (+0/-8)
dash/previews/MoviePreview.h (+1/-22)
dash/previews/MusicPreview.cpp (+0/-10)
dash/previews/MusicPreview.h (+1/-22)
dash/previews/Preview.cpp (+10/-0)
dash/previews/Preview.h (+21/-1)
dash/previews/SocialPreview.cpp (+0/-8)
dash/previews/SocialPreview.h (+1/-20)
To merge this branch: bzr merge lp:~townsend/unity/unity.refactor-preview
Reviewer Review Type Date Requested Status
Nick Dedekind (community) Needs Fixing
Brandon Schaefer (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+140976@code.launchpad.net

Commit message

Refactored the derived preview classes to put the common members into the base Preview class. This should help alleviate code redundancy, code readability, and make the creation of any future new derived preview classes easier.

Description of the change

= Issue =
The derived preview classes(ApplicationPreview, GenericPreview, etc.) have a bunch of redundancy and common members that can be moved into the base Preview class.

= Fix =
This moves the common members into the base Preview class. This should alleviate code redundancy, code readability, and make it easier to create any future new derived preview classes.

= Test =
This does not change any functionality, so the current tests should be sufficient.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Awesome! Nice clean up, everything looks good, compiles, and things still work :).

review: Approve
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

I think it's about time to get rid of the background layer. Now that previews are a bit more mature I think we can remove them from the code as they are not actually used.

Can you get rid of:
dash::Preview::details_bg_layer_
dash::Preview::SetupBackground
dash::preview::Style::GetShadowBackgroundEnabled

The reason why I didn't do this before is that some of the previews don't (or will not) use some of those members you have moved into the common class. eg. socialpreview does not use CoverArt (movie preview will not in future), Social does not use info hints, music and social don't use description.
Also the Payment preview which will be coming through soon won't use most of these fields.

444 + virtual void SetupViews() {}

Don't need it to be there or virtual. It's only called from the constructor of the derived class, so there's no need for it in the base class, esspecially since it doesn't do anything. There's no redundancy issue here because it's always overridden.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/previews/ApplicationPreview.cpp'
--- dash/previews/ApplicationPreview.cpp 2012-12-14 12:14:34 +0000
+++ dash/previews/ApplicationPreview.cpp 2012-12-20 19:09:20 +0000
@@ -24,7 +24,6 @@
24#include "unity-shared/PreviewStyle.h"24#include "unity-shared/PreviewStyle.h"
25#include "unity-shared/CoverArt.h"25#include "unity-shared/CoverArt.h"
26#include "unity-shared/IconTexture.h"26#include "unity-shared/IconTexture.h"
27#include "unity-shared/StaticCairoText.h"
28#include "unity-shared/PlacesOverlayVScrollBar.h"27#include "unity-shared/PlacesOverlayVScrollBar.h"
29#include <UnityCore/ApplicationPreview.h>28#include <UnityCore/ApplicationPreview.h>
30#include <NuxCore/Logger.h>29#include <NuxCore/Logger.h>
@@ -38,7 +37,6 @@
38 37
39#include "ApplicationPreview.h"38#include "ApplicationPreview.h"
40#include "ActionButton.h"39#include "ActionButton.h"
41#include "PreviewInfoHintWidget.h"
42#include "PreviewRatingsWidget.h"40#include "PreviewRatingsWidget.h"
4341
44namespace unity42namespace unity
@@ -64,7 +62,6 @@
6462
65ApplicationPreview::ApplicationPreview(dash::Preview::Ptr preview_model)63ApplicationPreview::ApplicationPreview(dash::Preview::Ptr preview_model)
66: Preview(preview_model)64: Preview(preview_model)
67, full_data_layout_(nullptr)
68{65{
69 SetupBackground();66 SetupBackground();
70 SetupViews();67 SetupViews();
@@ -133,11 +130,6 @@
133 Preview::AddProperties(builder);130 Preview::AddProperties(builder);
134}131}
135132
136void ApplicationPreview::SetupBackground()
137{
138 details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
139}
140
141void ApplicationPreview::SetupViews()133void ApplicationPreview::SetupViews()
142{134{
143 dash::ApplicationPreview* app_preview_model = dynamic_cast<dash::ApplicationPreview*>(preview_model_.get());135 dash::ApplicationPreview* app_preview_model = dynamic_cast<dash::ApplicationPreview*>(preview_model_.get());
144136
=== modified file 'dash/previews/ApplicationPreview.h'
--- dash/previews/ApplicationPreview.h 2012-12-14 12:14:34 +0000
+++ dash/previews/ApplicationPreview.h 2012-12-20 19:09:20 +0000
@@ -24,14 +24,6 @@
24#define APPLICATIONPREVIEW_H24#define APPLICATIONPREVIEW_H
2525
26#include "Preview.h"26#include "Preview.h"
27#include <Nux/Nux.h>
28
29namespace nux
30{
31class AbstractPaintLayer;
32class VLayout;
33class StaticCairoText;
34}
3527
36namespace unity28namespace unity
37{29{
@@ -41,9 +33,7 @@
41{33{
42namespace previews34namespace previews
43{35{
44class CoverArt;
45class PreviewRatingsWidget;36class PreviewRatingsWidget;
46class PreviewInfoHintWidget;
4737
48class ApplicationPreview : public Preview38class ApplicationPreview : public Preview
49{39{
@@ -63,26 +53,16 @@
63 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);53 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
64 virtual void PreLayoutManagement();54 virtual void PreLayoutManagement();
6555
66 void SetupBackground();56 virtual void SetupViews();
67 void SetupViews();
6857
69protected:58protected:
70 nux::VLayout* full_data_layout_;
71 nux::VLayout* title_subtitle_layout_;59 nux::VLayout* title_subtitle_layout_;
7260
73 nux::ObjectPtr<CoverArt> image_;
74 nux::ObjectPtr<IconTexture> app_icon_;61 nux::ObjectPtr<IconTexture> app_icon_;
75 nux::ObjectPtr<PreviewRatingsWidget> app_rating_;62 nux::ObjectPtr<PreviewRatingsWidget> app_rating_;
76 nux::ObjectPtr<StaticCairoText> title_;
77 nux::ObjectPtr<StaticCairoText> subtitle_;
78 nux::ObjectPtr<StaticCairoText> license_;63 nux::ObjectPtr<StaticCairoText> license_;
79 nux::ObjectPtr<StaticCairoText> last_update_;64 nux::ObjectPtr<StaticCairoText> last_update_;
80 nux::ObjectPtr<StaticCairoText> copywrite_;65 nux::ObjectPtr<StaticCairoText> copywrite_;
81 nux::ObjectPtr<StaticCairoText> description_;
82 nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
83
84 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
85 LayerPtr details_bg_layer_;
86};66};
8767
88}68}
8969
=== modified file 'dash/previews/GenericPreview.cpp'
--- dash/previews/GenericPreview.cpp 2012-12-14 12:14:34 +0000
+++ dash/previews/GenericPreview.cpp 2012-12-20 19:09:20 +0000
@@ -23,7 +23,6 @@
23#include "unity-shared/IntrospectableWrappers.h"23#include "unity-shared/IntrospectableWrappers.h"
24#include "unity-shared/PreviewStyle.h"24#include "unity-shared/PreviewStyle.h"
25#include "unity-shared/CoverArt.h"25#include "unity-shared/CoverArt.h"
26#include "unity-shared/StaticCairoText.h"
27#include "unity-shared/PlacesOverlayVScrollBar.h"26#include "unity-shared/PlacesOverlayVScrollBar.h"
28#include <NuxCore/Logger.h>27#include <NuxCore/Logger.h>
29#include <Nux/HLayout.h>28#include <Nux/HLayout.h>
@@ -33,7 +32,6 @@
33#include <Nux/AbstractButton.h>32#include <Nux/AbstractButton.h>
3433
35#include "GenericPreview.h"34#include "GenericPreview.h"
36#include "PreviewInfoHintWidget.h"
3735
38namespace unity36namespace unity
39{37{
@@ -58,7 +56,6 @@
5856
59GenericPreview::GenericPreview(dash::Preview::Ptr preview_model)57GenericPreview::GenericPreview(dash::Preview::Ptr preview_model)
60: Preview(preview_model)58: Preview(preview_model)
61, full_data_layout_(nullptr)
62{59{
63 SetupBackground();60 SetupBackground();
64 SetupViews();61 SetupViews();
@@ -127,11 +124,6 @@
127 Preview::AddProperties(builder);124 Preview::AddProperties(builder);
128}125}
129126
130void GenericPreview::SetupBackground()
131{
132 details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
133}
134
135void GenericPreview::SetupViews()127void GenericPreview::SetupViews()
136{128{
137 if (!preview_model_)129 if (!preview_model_)
138130
=== modified file 'dash/previews/GenericPreview.h'
--- dash/previews/GenericPreview.h 2012-12-14 12:14:34 +0000
+++ dash/previews/GenericPreview.h 2012-12-20 19:09:20 +0000
@@ -24,24 +24,14 @@
24#define GENERICPREVIEW_H24#define GENERICPREVIEW_H
2525
26#include "Preview.h"26#include "Preview.h"
27#include <Nux/Nux.h>
28#include <UnityCore/GenericPreview.h>27#include <UnityCore/GenericPreview.h>
2928
30namespace nux
31{
32class AbstractPaintLayer;
33class StaticCairoText;
34class VLayout;
35}
36
37namespace unity29namespace unity
38{30{
39namespace dash31namespace dash
40{32{
41namespace previews33namespace previews
42{34{
43class CoverArt;
44class PreviewInfoHintWidget;
4535
46class GenericPreview : public Preview36class GenericPreview : public Preview
47{37{
@@ -61,20 +51,7 @@
61 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);51 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
62 virtual void PreLayoutManagement();52 virtual void PreLayoutManagement();
6353
64 void SetupBackground();54 virtual void SetupViews();
65 void SetupViews();
66
67protected:
68 nux::VLayout* full_data_layout_;
69
70 nux::ObjectPtr<CoverArt> image_;
71 nux::ObjectPtr<StaticCairoText> title_;
72 nux::ObjectPtr<StaticCairoText> subtitle_;
73 nux::ObjectPtr<StaticCairoText> description_;
74 nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
75
76 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
77 LayerPtr details_bg_layer_;
78};55};
7956
80}57}
8158
=== modified file 'dash/previews/MoviePreview.cpp'
--- dash/previews/MoviePreview.cpp 2012-12-14 12:14:34 +0000
+++ dash/previews/MoviePreview.cpp 2012-12-20 19:09:20 +0000
@@ -23,7 +23,6 @@
23#include "unity-shared/IntrospectableWrappers.h"23#include "unity-shared/IntrospectableWrappers.h"
24#include "unity-shared/PreviewStyle.h"24#include "unity-shared/PreviewStyle.h"
25#include "unity-shared/CoverArt.h"25#include "unity-shared/CoverArt.h"
26#include "unity-shared/StaticCairoText.h"
27#include "unity-shared/PlacesOverlayVScrollBar.h"26#include "unity-shared/PlacesOverlayVScrollBar.h"
28#include <UnityCore/MoviePreview.h>27#include <UnityCore/MoviePreview.h>
29#include <NuxCore/Logger.h>28#include <NuxCore/Logger.h>
@@ -33,7 +32,6 @@
33#include <Nux/AbstractButton.h>32#include <Nux/AbstractButton.h>
3433
35#include "MoviePreview.h"34#include "MoviePreview.h"
36#include "PreviewInfoHintWidget.h"
37#include "PreviewRatingsWidget.h"35#include "PreviewRatingsWidget.h"
38 36
39namespace unity37namespace unity
@@ -59,7 +57,6 @@
5957
60MoviePreview::MoviePreview(dash::Preview::Ptr preview_model)58MoviePreview::MoviePreview(dash::Preview::Ptr preview_model)
61: Preview(preview_model)59: Preview(preview_model)
62, full_data_layout_(nullptr)
63{60{
64 SetupBackground();61 SetupBackground();
65 SetupView();62 SetupView();
@@ -136,11 +133,6 @@
136{133{
137}134}
138135
139void MoviePreview::SetupBackground()
140{
141 details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
142}
143
144void MoviePreview::SetupView()136void MoviePreview::SetupView()
145{137{
146 dash::MoviePreview* movie_preview_model = dynamic_cast<dash::MoviePreview*>(preview_model_.get());138 dash::MoviePreview* movie_preview_model = dynamic_cast<dash::MoviePreview*>(preview_model_.get());
147139
=== modified file 'dash/previews/MoviePreview.h'
--- dash/previews/MoviePreview.h 2012-12-14 12:14:34 +0000
+++ dash/previews/MoviePreview.h 2012-12-20 19:09:20 +0000
@@ -24,14 +24,6 @@
24#define MOVIEPREVIEW_H24#define MOVIEPREVIEW_H
2525
26#include "Preview.h"26#include "Preview.h"
27#include <Nux/Nux.h>
28
29namespace nux
30{
31class AbstractPaintLayer;
32class StaticCairoText;
33class VLayout;
34}
3527
36namespace unity28namespace unity
37{29{
@@ -39,9 +31,7 @@
39{31{
40namespace previews32namespace previews
41{33{
42class CoverArt;
43class PreviewRatingsWidget;34class PreviewRatingsWidget;
44class PreviewInfoHintWidget;
4535
46class MoviePreview : public Preview36class MoviePreview : public Preview
47{37{
@@ -64,21 +54,10 @@
64 virtual void OnNavigateOut();54 virtual void OnNavigateOut();
65 virtual void OnNavigateInComplete();55 virtual void OnNavigateInComplete();
6656
67 void SetupBackground();57 virtual void SetupView();
68 void SetupView();
69 58
70protected:59protected:
71 nux::VLayout* full_data_layout_;
72
73 nux::ObjectPtr<CoverArt> image_;
74 nux::ObjectPtr<PreviewRatingsWidget> rating_;60 nux::ObjectPtr<PreviewRatingsWidget> rating_;
75 nux::ObjectPtr<StaticCairoText> title_;
76 nux::ObjectPtr<StaticCairoText> subtitle_;
77 nux::ObjectPtr<StaticCairoText> description_;
78 nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
79
80 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
81 LayerPtr details_bg_layer_;
82};61};
8362
84}63}
8564
=== modified file 'dash/previews/MusicPreview.cpp'
--- dash/previews/MusicPreview.cpp 2012-12-14 12:14:34 +0000
+++ dash/previews/MusicPreview.cpp 2012-12-20 19:09:20 +0000
@@ -24,7 +24,6 @@
24#include "unity-shared/PreviewStyle.h"24#include "unity-shared/PreviewStyle.h"
25#include "unity-shared/CoverArt.h"25#include "unity-shared/CoverArt.h"
26#include "unity-shared/IconTexture.h"26#include "unity-shared/IconTexture.h"
27#include "unity-shared/StaticCairoText.h"
28#include <UnityCore/MusicPreview.h>27#include <UnityCore/MusicPreview.h>
29#include <NuxCore/Logger.h>28#include <NuxCore/Logger.h>
30#include <Nux/HLayout.h>29#include <Nux/HLayout.h>
@@ -33,7 +32,6 @@
33 32
34#include "MusicPreview.h"33#include "MusicPreview.h"
35#include "ActionButton.h"34#include "ActionButton.h"
36#include "PreviewInfoHintWidget.h"
37#include "Tracks.h"35#include "Tracks.h"
3836
39namespace unity37namespace unity
@@ -48,9 +46,6 @@
4846
49MusicPreview::MusicPreview(dash::Preview::Ptr preview_model)47MusicPreview::MusicPreview(dash::Preview::Ptr preview_model)
50: Preview(preview_model)48: Preview(preview_model)
51, image_(nullptr)
52, title_(nullptr)
53, subtitle_(nullptr)
54{49{
55 SetupBackground();50 SetupBackground();
56 SetupViews();51 SetupViews();
@@ -119,11 +114,6 @@
119 Preview::AddProperties(builder);114 Preview::AddProperties(builder);
120}115}
121116
122void MusicPreview::SetupBackground()
123{
124 details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
125}
126
127void MusicPreview::SetupViews()117void MusicPreview::SetupViews()
128{118{
129 dash::MusicPreview* music_preview_model = dynamic_cast<dash::MusicPreview*>(preview_model_.get());119 dash::MusicPreview* music_preview_model = dynamic_cast<dash::MusicPreview*>(preview_model_.get());
130120
=== modified file 'dash/previews/MusicPreview.h'
--- dash/previews/MusicPreview.h 2012-12-14 12:14:34 +0000
+++ dash/previews/MusicPreview.h 2012-12-20 19:09:20 +0000
@@ -24,15 +24,6 @@
24#define MUSICPREVIEW_H24#define MUSICPREVIEW_H
2525
26#include "Preview.h"26#include "Preview.h"
27#include <Nux/Nux.h>
28#include <Nux/StaticText.h>
29
30namespace nux
31{
32class AbstractPaintLayer;
33class StaticCairoText;
34class VLayout;
35}
3627
37namespace unity28namespace unity
38{29{
@@ -40,8 +31,6 @@
40{31{
41namespace previews32namespace previews
42{33{
43class CoverArt;
44class PreviewInfoHintWidget;
45class Tracks;34class Tracks;
4635
47class MusicPreview : public Preview36class MusicPreview : public Preview
@@ -62,23 +51,13 @@
62 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);51 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
63 virtual void PreLayoutManagement();52 virtual void PreLayoutManagement();
6453
65 void SetupBackground();54 virtual void SetupViews();
66 void SetupViews();
6755
68 void OnPlayTrack(std::string const& uri);56 void OnPlayTrack(std::string const& uri);
69 void OnPauseTrack(std::string const& uri);57 void OnPauseTrack(std::string const& uri);
7058
71protected:59protected:
72 nux::VLayout* full_data_layout_;
73
74 nux::ObjectPtr<CoverArt> image_;
75 nux::ObjectPtr<StaticCairoText> title_;
76 nux::ObjectPtr<StaticCairoText> subtitle_;
77 nux::ObjectPtr<Tracks> tracks_;60 nux::ObjectPtr<Tracks> tracks_;
78 nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
79
80 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
81 LayerPtr details_bg_layer_;
82 };61 };
8362
84}63}
8564
=== modified file 'dash/previews/Preview.cpp'
--- dash/previews/Preview.cpp 2012-11-08 09:12:24 +0000
+++ dash/previews/Preview.cpp 2012-12-20 19:09:20 +0000
@@ -33,6 +33,7 @@
33#include "MusicPreview.h"33#include "MusicPreview.h"
34#include "MoviePreview.h"34#include "MoviePreview.h"
35#include "SocialPreview.h"35#include "SocialPreview.h"
36#include "PreviewInfoHintWidget.h"
3637
37namespace unity38namespace unity
38{39{
@@ -219,6 +220,10 @@
219 : View(NUX_TRACKER_LOCATION)220 : View(NUX_TRACKER_LOCATION)
220 , preview_model_(preview_model)221 , preview_model_(preview_model)
221 , tab_iterator_(new TabIterator())222 , tab_iterator_(new TabIterator())
223 , full_data_layout_(nullptr)
224 , image_(nullptr)
225 , title_(nullptr)
226 , subtitle_(nullptr)
222{227{
223}228}
224229
@@ -363,6 +368,11 @@
363 nux::GetWindowCompositor().SetKeyFocusArea(default_focus);368 nux::GetWindowCompositor().SetKeyFocusArea(default_focus);
364}369}
365370
371void Preview::SetupBackground()
372{
373 details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
374}
375
366}376}
367}377}
368}378}
369379
=== modified file 'dash/previews/Preview.h'
--- dash/previews/Preview.h 2012-09-18 09:05:50 +0000
+++ dash/previews/Preview.h 2012-12-20 19:09:20 +0000
@@ -28,11 +28,16 @@
28#include <UnityCore/Preview.h>28#include <UnityCore/Preview.h>
29#include "unity-shared/Introspectable.h"29#include "unity-shared/Introspectable.h"
30#include "unity-shared/PreviewStyle.h"30#include "unity-shared/PreviewStyle.h"
31#include "unity-shared/StaticCairoText.h"
32#include "PreviewInfoHintWidget.h"
3133
32namespace nux34namespace nux
33{35{
34class AbstractButton;36class AbstractButton;
37class AbstractPaintLayer;
35class Layout;38class Layout;
39class VLayout;
40class StaticCairoText;
36}41}
3742
38namespace unity43namespace unity
@@ -45,6 +50,7 @@
45{50{
46class CoverArt;51class CoverArt;
47class TabIterator;52class TabIterator;
53class PreviewInfoHintWidget;
4854
49class Preview : public nux::View, public debug::Introspectable55class Preview : public nux::View, public debug::Introspectable
50{56{
@@ -80,9 +86,12 @@
8086
81 virtual bool AcceptKeyNavFocus() { return false; }87 virtual bool AcceptKeyNavFocus() { return false; }
8288
89 virtual void SetupViews() {}
90 void SetupBackground();
91
83 nux::Layout* BuildGridActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons);92 nux::Layout* BuildGridActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons);
84 nux::Layout* BuildVerticalActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons);93 nux::Layout* BuildVerticalActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons);
85 94
86 void UpdateCoverArtImage(CoverArt* cover_art);95 void UpdateCoverArtImage(CoverArt* cover_art);
8796
88protected:97protected:
@@ -90,6 +99,17 @@
90 std::list<nux::AbstractButton*> action_buttons_;99 std::list<nux::AbstractButton*> action_buttons_;
91 TabIterator* tab_iterator_;100 TabIterator* tab_iterator_;
92101
102 nux::VLayout* full_data_layout_;
103
104 nux::ObjectPtr<CoverArt> image_;
105 nux::ObjectPtr<StaticCairoText> title_;
106 nux::ObjectPtr<StaticCairoText> subtitle_;
107 nux::ObjectPtr<StaticCairoText> description_;
108 PreviewInfoHintWidget::Ptr preview_info_hints_;
109
110 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
111 LayerPtr details_bg_layer_;
112
93 friend class PreviewContent;113 friend class PreviewContent;
94};114};
95115
96116
=== modified file 'dash/previews/SocialPreview.cpp'
--- dash/previews/SocialPreview.cpp 2012-12-17 21:30:27 +0000
+++ dash/previews/SocialPreview.cpp 2012-12-20 19:09:20 +0000
@@ -24,7 +24,6 @@
24#include "unity-shared/PreviewStyle.h"24#include "unity-shared/PreviewStyle.h"
25#include "unity-shared/CoverArt.h"25#include "unity-shared/CoverArt.h"
26#include "unity-shared/IconTexture.h"26#include "unity-shared/IconTexture.h"
27#include "unity-shared/StaticCairoText.h"
28#include "unity-shared/PlacesOverlayVScrollBar.h"27#include "unity-shared/PlacesOverlayVScrollBar.h"
29#include <UnityCore/SocialPreview.h>28#include <UnityCore/SocialPreview.h>
30#include <NuxCore/Logger.h>29#include <NuxCore/Logger.h>
@@ -40,7 +39,6 @@
40#include "SocialPreviewContent.h"39#include "SocialPreviewContent.h"
41#include "SocialPreviewComments.h"40#include "SocialPreviewComments.h"
42#include "ActionButton.h"41#include "ActionButton.h"
43#include "PreviewInfoHintWidget.h"
4442
45namespace unity43namespace unity
46{44{
@@ -65,7 +63,6 @@
6563
66SocialPreview::SocialPreview(dash::Preview::Ptr preview_model)64SocialPreview::SocialPreview(dash::Preview::Ptr preview_model)
67: Preview(preview_model)65: Preview(preview_model)
68, full_data_layout_(nullptr)
69{66{
70 SetupBackground();67 SetupBackground();
71 SetupViews();68 SetupViews();
@@ -134,11 +131,6 @@
134 Preview::AddProperties(builder);131 Preview::AddProperties(builder);
135}132}
136133
137void SocialPreview::SetupBackground()
138{
139 details_bg_layer_.reset(dash::previews::Style::Instance().GetBackgroundLayer());
140}
141
142void SocialPreview::SetupViews()134void SocialPreview::SetupViews()
143{135{
144 dash::SocialPreview* social_preview_model = dynamic_cast<dash::SocialPreview*>(preview_model_.get());136 dash::SocialPreview* social_preview_model = dynamic_cast<dash::SocialPreview*>(preview_model_.get());
145137
=== modified file 'dash/previews/SocialPreview.h'
--- dash/previews/SocialPreview.h 2012-12-14 12:14:34 +0000
+++ dash/previews/SocialPreview.h 2012-12-20 19:09:20 +0000
@@ -24,14 +24,6 @@
24#define SOCIALPREVIEW_H24#define SOCIALPREVIEW_H
2525
26#include "Preview.h"26#include "Preview.h"
27#include <Nux/Nux.h>
28
29namespace nux
30{
31class AbstractPaintLayer;
32class VLayout;
33class StaticCairoText;
34}
3527
36namespace unity28namespace unity
37{29{
@@ -41,9 +33,7 @@
41{33{
42namespace previews34namespace previews
43{35{
44class CoverArt;
45class PreviewLikesWidget;36class PreviewLikesWidget;
46class PreviewInfoHintWidget;
47class SocialPreviewContent;37class SocialPreviewContent;
48class SocialPreviewComments;38class SocialPreviewComments;
4939
@@ -65,25 +55,16 @@
65 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);55 virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
66 virtual void PreLayoutManagement();56 virtual void PreLayoutManagement();
6757
68 void SetupBackground();58 virtual void SetupViews();
69 void SetupViews();
7059
71protected:60protected:
72 nux::VLayout* full_data_layout_;
73 nux::VLayout* sender_layout_;61 nux::VLayout* sender_layout_;
74 nux::VLayout* title_layout_;62 nux::VLayout* title_layout_;
7563
76 nux::ObjectPtr<IconTexture> avatar_;64 nux::ObjectPtr<IconTexture> avatar_;
77 nux::ObjectPtr<CoverArt> image_;
78 nux::ObjectPtr<SocialPreviewContent> content_;65 nux::ObjectPtr<SocialPreviewContent> content_;
79 nux::ObjectPtr<SocialPreviewComments> comments_;66 nux::ObjectPtr<SocialPreviewComments> comments_;
80 nux::ObjectPtr<StaticCairoText> title_;
81 nux::ObjectPtr<StaticCairoText> subtitle_;
82 nux::ObjectPtr<StaticCairoText> comments_hint_;67 nux::ObjectPtr<StaticCairoText> comments_hint_;
83 nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
84
85 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
86 LayerPtr details_bg_layer_;
87};68};
8869
89}70}