summaryrefslogtreecommitdiff
path: root/dash
diff options
authorGord Allott <gord.allott@canonical.com>2012-08-15 15:16:19 +0100
committerGord Allott <gord.allott@canonical.com>2012-08-15 15:16:19 +0100
commitd1a0f6c668ae35cea9966035a4638bb2285d625a (patch)
treee60c9404facb3a1488ab8b163a78cefe167930da /dash
parentbc39318e673aa0b418b0b07057cd92cb06425ce8 (diff)
parente48710af0f468f3f87efd62944b657f1e4670479 (diff)
latest previews ui
(bzr r2419.6.34)
Diffstat (limited to 'dash')
-rw-r--r--dash/PlacesGroup.cpp3
-rw-r--r--dash/previews/ActionButton.h3
-rw-r--r--dash/previews/ApplicationPreview.cpp9
-rw-r--r--dash/previews/ApplicationPreview.h3
-rw-r--r--dash/previews/GenericPreview.cpp4
-rw-r--r--dash/previews/GenericPreview.h2
-rw-r--r--dash/previews/MoviePreview.cpp4
-rw-r--r--dash/previews/MoviePreview.h2
-rw-r--r--dash/previews/MusicPreview.cpp11
-rw-r--r--dash/previews/MusicPreview.h8
-rw-r--r--dash/previews/PreviewRatingsWidget.cpp5
-rw-r--r--dash/previews/PreviewRatingsWidget.h2
12 files changed, 36 insertions, 20 deletions
diff --git a/dash/PlacesGroup.cpp b/dash/PlacesGroup.cpp
index 3d9aee07e..86ef8ec7c 100644
--- a/dash/PlacesGroup.cpp
+++ b/dash/PlacesGroup.cpp
@@ -369,7 +369,8 @@ long PlacesGroup::ComputeContentSize()
nux::Geometry const& geo = GetGeometry();
- if (_cached_geometry != geo)
+ // only the width matters
+ if (_cached_geometry.GetWidth() != geo.GetWidth())
{
_focus_layer.reset(dash::Style::Instance().FocusOverlay(geo.width - kHighlightLeftPadding - kHighlightRightPadding, kHighlightHeight));
diff --git a/dash/previews/ActionButton.h b/dash/previews/ActionButton.h
index d2bb11ef5..383e63ccc 100644
--- a/dash/previews/ActionButton.h
+++ b/dash/previews/ActionButton.h
@@ -65,7 +65,7 @@ protected:
void BuildLayout(std::string const& label, std::string const& icon_hint);
-
+private:
typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
NuxCairoPtr cr_prelight_;
@@ -75,7 +75,6 @@ protected:
nux::Geometry cached_geometry_;
-private:
std::string icon_hint_;
std::string font_hint_;
diff --git a/dash/previews/ApplicationPreview.cpp b/dash/previews/ApplicationPreview.cpp
index 61ca8d3fe..69b3bc538 100644
--- a/dash/previews/ApplicationPreview.cpp
+++ b/dash/previews/ApplicationPreview.cpp
@@ -236,7 +236,10 @@ void ApplicationPreview::SetupViews()
if (!app_preview_model->last_update.Get().empty())
{
- last_update_ = new nux::StaticCairoText(_("Last Updated ") + app_preview_model->last_update.Get());
+ std::stringstream last_update;
+ last_update << _("Last Updated") << " " << app_preview_model->last_update.Get();
+
+ last_update_ = new nux::StaticCairoText(last_update.str());
last_update_->SetFont(style.app_last_update_font().c_str());
app_updated_copywrite_layout->AddView(last_update_.GetPointer(), 1);
}
@@ -281,8 +284,8 @@ void ApplicationPreview::SetupViews()
if (!preview_model_->GetInfoHints().empty())
{
- PreviewInfoHintWidget* preview_info_hints = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
- app_info_layout->AddView(preview_info_hints);
+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
+ app_info_layout->AddView(preview_info_hints_.GetPointer());
}
/////////////////////
diff --git a/dash/previews/ApplicationPreview.h b/dash/previews/ApplicationPreview.h
index d2756420f..bf1fb6e12 100644
--- a/dash/previews/ApplicationPreview.h
+++ b/dash/previews/ApplicationPreview.h
@@ -42,8 +42,8 @@ namespace dash
namespace previews
{
class CoverArt;
-
class PreviewRatingsWidget;
+class PreviewInfoHintWidget;
class ApplicationPreview : public Preview
{
@@ -79,6 +79,7 @@ protected:
nux::ObjectPtr<nux::StaticCairoText> last_update_;
nux::ObjectPtr<nux::StaticCairoText> copywrite_;
nux::ObjectPtr<nux::StaticCairoText> description_;
+ nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
LayerPtr details_bg_layer_;
diff --git a/dash/previews/GenericPreview.cpp b/dash/previews/GenericPreview.cpp
index 7578b2b65..b5c572152 100644
--- a/dash/previews/GenericPreview.cpp
+++ b/dash/previews/GenericPreview.cpp
@@ -208,8 +208,8 @@ void GenericPreview::SetupViews()
if (!preview_model_->GetInfoHints().empty())
{
- PreviewInfoHintWidget* preview_info_hints = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
- preview_info_layout->AddView(preview_info_hints);
+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
+ preview_info_layout->AddView(preview_info_hints_.GetPointer());
}
/////////////////////
diff --git a/dash/previews/GenericPreview.h b/dash/previews/GenericPreview.h
index 01b0e57a8..535bcc4b7 100644
--- a/dash/previews/GenericPreview.h
+++ b/dash/previews/GenericPreview.h
@@ -41,6 +41,7 @@ namespace dash
namespace previews
{
class CoverArt;
+class PreviewInfoHintWidget;
class GenericPreview : public Preview
{
@@ -70,6 +71,7 @@ protected:
nux::ObjectPtr<nux::StaticCairoText> title_;
nux::ObjectPtr<nux::StaticCairoText> subtitle_;
nux::ObjectPtr<nux::StaticCairoText> description_;
+ nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
LayerPtr details_bg_layer_;
diff --git a/dash/previews/MoviePreview.cpp b/dash/previews/MoviePreview.cpp
index 290d90d88..0a4654762 100644
--- a/dash/previews/MoviePreview.cpp
+++ b/dash/previews/MoviePreview.cpp
@@ -218,8 +218,8 @@ void MoviePreview::SetupView()
if (!preview_model_->GetInfoHints().empty())
{
- PreviewInfoHintWidget* preview_info_hints = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
- preview_info_layout->AddView(preview_info_hints, 0);
+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
+ preview_info_layout->AddView(preview_info_hints_.GetPointer(), 0);
}
if (!preview_model_->description.Get().empty())
diff --git a/dash/previews/MoviePreview.h b/dash/previews/MoviePreview.h
index 9f983e2fe..14876cdd1 100644
--- a/dash/previews/MoviePreview.h
+++ b/dash/previews/MoviePreview.h
@@ -41,6 +41,7 @@ namespace previews
{
class CoverArt;
class PreviewRatingsWidget;
+class PreviewInfoHintWidget;
class MoviePreview : public Preview
{
@@ -74,6 +75,7 @@ protected:
nux::ObjectPtr<nux::StaticCairoText> title_;
nux::ObjectPtr<nux::StaticCairoText> subtitle_;
nux::ObjectPtr<nux::StaticCairoText> description_;
+ nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
LayerPtr details_bg_layer_;
diff --git a/dash/previews/MusicPreview.cpp b/dash/previews/MusicPreview.cpp
index a4772aa7a..2fffa3388 100644
--- a/dash/previews/MusicPreview.cpp
+++ b/dash/previews/MusicPreview.cpp
@@ -189,10 +189,9 @@ void MusicPreview::SetupViews()
dash::Tracks::Ptr tracks_model = music_preview_model->GetTracksModel();
if (tracks_model)
{
- previews::Tracks* tracks = new previews::Tracks(tracks_model, NUX_TRACKER_LOCATION);
- tracks->play.connect(sigc::mem_fun(this, &MusicPreview::OnPlayTrack));
- tracks->pause.connect(sigc::mem_fun(this, &MusicPreview::OnPauseTrack));
- tracks_ = tracks;
+ tracks_ = new previews::Tracks(tracks_model, NUX_TRACKER_LOCATION);
+ tracks_->play.connect(sigc::mem_fun(this, &MusicPreview::OnPlayTrack));
+ tracks_->pause.connect(sigc::mem_fun(this, &MusicPreview::OnPauseTrack));
}
/////////////////////
@@ -207,8 +206,8 @@ void MusicPreview::SetupViews()
hints_layout = new nux::VLayout();
hints_layout->SetSpaceBetweenChildren(0);
hints_layout->AddSpace(0, 1);
- PreviewInfoHintWidget* preview_info_hints = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
- hints_layout->AddView(preview_info_hints, 0);
+ preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
+ hints_layout->AddView(preview_info_hints_.GetPointer(), 0);
// If there are actions, we use a vertical layout
action_buttons_.clear();
diff --git a/dash/previews/MusicPreview.h b/dash/previews/MusicPreview.h
index 7566b6a94..d70480243 100644
--- a/dash/previews/MusicPreview.h
+++ b/dash/previews/MusicPreview.h
@@ -40,9 +40,10 @@ namespace dash
{
namespace previews
{
+class CoverArt;
+class PreviewInfoHintWidget;
class Tracks;
-
class MusicPreview : public Preview
{
public:
@@ -67,13 +68,14 @@ protected:
void OnPlayTrack(std::string const& uri);
void OnPauseTrack(std::string const& uri);
-private:
+protected:
nux::VLayout* full_data_layout_;
nux::ObjectPtr<CoverArt> image_;
nux::ObjectPtr<nux::StaticCairoText> title_;
nux::ObjectPtr<nux::StaticCairoText> subtitle_;
- nux::ObjectPtr<nux::View> tracks_;
+ nux::ObjectPtr<Tracks> tracks_;
+ nux::ObjectPtr<PreviewInfoHintWidget> preview_info_hints_;
typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
LayerPtr details_bg_layer_;
diff --git a/dash/previews/PreviewRatingsWidget.cpp b/dash/previews/PreviewRatingsWidget.cpp
index 34d20c7f6..ea1c1014b 100644
--- a/dash/previews/PreviewRatingsWidget.cpp
+++ b/dash/previews/PreviewRatingsWidget.cpp
@@ -68,6 +68,11 @@ void PreviewRatingsWidget::SetRating(float rating)
ratings_->SetRating(rating);
}
+float PreviewRatingsWidget::GetRating() const
+{
+ return ratings_->GetRating();
+}
+
void PreviewRatingsWidget::SetReviews(int count)
{
std::stringstream out;
diff --git a/dash/previews/PreviewRatingsWidget.h b/dash/previews/PreviewRatingsWidget.h
index 424fb8139..ca2031c34 100644
--- a/dash/previews/PreviewRatingsWidget.h
+++ b/dash/previews/PreviewRatingsWidget.h
@@ -47,6 +47,8 @@ public:
virtual ~PreviewRatingsWidget();
void SetRating(float rating);
+ float GetRating() const;
+
void SetReviews(int count);
protected: