summaryrefslogtreecommitdiff
path: root/unity-shared
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 /unity-shared
parentbc39318e673aa0b418b0b07057cd92cb06425ce8 (diff)
parente48710af0f468f3f87efd62944b657f1e4670479 (diff)
latest previews ui
(bzr r2419.6.34)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/IconRenderer.cpp4
-rw-r--r--unity-shared/RatingsButton.cpp12
-rw-r--r--unity-shared/RatingsButton.h3
-rw-r--r--unity-shared/ThumbnailGenerator.cpp11
4 files changed, 17 insertions, 13 deletions
diff --git a/unity-shared/IconRenderer.cpp b/unity-shared/IconRenderer.cpp
index ed1fa65e6..2c37cc89c 100644
--- a/unity-shared/IconRenderer.cpp
+++ b/unity-shared/IconRenderer.cpp
@@ -757,8 +757,8 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0));
CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
- int VertexLocation;
- int TextureCoord0Location;
+ int VertexLocation = -1;
+ int TextureCoord0Location = -1;
int FragmentColor = 0;
int ColorifyColor = 0;
int DesatFactor = 0;
diff --git a/unity-shared/RatingsButton.cpp b/unity-shared/RatingsButton.cpp
index b28dab690..c479c65ff 100644
--- a/unity-shared/RatingsButton.cpp
+++ b/unity-shared/RatingsButton.cpp
@@ -80,6 +80,11 @@ void RatingsButton::SetRating(float rating)
QueueDraw();
}
+float RatingsButton::GetRating() const
+{
+ return rating_;
+}
+
void RatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
int rating = static_cast<int>(rating_ * num_stars);
@@ -177,7 +182,7 @@ void RatingsButton::UpdateRatingToMouse(int x)
new_rating = ceil((num_stars * 1) * new_rating) / (num_stars * 1);
new_rating = (new_rating > 1) ? 1 : ((new_rating < 0) ? 0 : new_rating);
- UpdateRating(new_rating);
+ SetRating(new_rating);
}
void RatingsButton::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags)
@@ -270,9 +275,4 @@ bool RatingsButton::AcceptKeyNavFocus()
return true;
}
-void RatingsButton::UpdateRating(float rating)
-{
-
-}
-
} // namespace unity
diff --git a/unity-shared/RatingsButton.h b/unity-shared/RatingsButton.h
index 1d33c9ddd..9364c0f2c 100644
--- a/unity-shared/RatingsButton.h
+++ b/unity-shared/RatingsButton.h
@@ -40,6 +40,7 @@ public:
void SetEditable(bool editable);
virtual void SetRating(float rating);
+ virtual float GetRating() const;
protected:
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
@@ -48,8 +49,6 @@ protected:
virtual bool AcceptKeyNavFocus();
virtual bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
- virtual void UpdateRating(float rating);
-
private:
void OnKeyDown(unsigned long event_type, unsigned long event_keysym,
unsigned long event_state, const TCHAR* character,
diff --git a/unity-shared/ThumbnailGenerator.cpp b/unity-shared/ThumbnailGenerator.cpp
index 0245f5f03..d13be2b9e 100644
--- a/unity-shared/ThumbnailGenerator.cpp
+++ b/unity-shared/ThumbnailGenerator.cpp
@@ -96,6 +96,7 @@ public:
: parent_(parent)
, thumbnails_mutex_(PTHREAD_MUTEX_INITIALIZER)
, thumbnail_thread_is_running_(false)
+ , thumbnail_thread_(0)
{}
~ThumbnailGeneratorImpl()
@@ -198,7 +199,6 @@ ThumbnailNotifier::Ptr ThumbnailGeneratorImpl::GetThumbnail(std::string const& u
if (!thread_create_timer_ && thumbnail_thread_is_running_ == false)
{
-
thread_create_timer_.reset(new glib::Timeout(0, [&]()
{
thumbnail_thread_is_running_ = true;
@@ -441,7 +441,8 @@ ThumbnailGenerator::ThumbnailGenerator()
ThumbnailGenerator::~ThumbnailGenerator()
{
-
+ if (this == thumbnail_instance)
+ thumbnail_instance = NULL;
}
ThumbnailGenerator& ThumbnailGenerator::Instance()
@@ -497,7 +498,9 @@ std::string Thumbnail::Generate(std::string& error_hint)
glib::Object<GFileInfo> file_info(g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, G_FILE_QUERY_INFO_NONE, NULL, &err));
if (err != NULL)
{
- error_hint = err->message;
+ std::stringstream error_stream;
+ error_stream << "Could not retrieve file info for '" << uri_ << "'";
+ error_hint = error_stream.str();
g_error_free (err);
return "";
}
@@ -518,6 +521,8 @@ std::string Thumbnail::Generate(std::string& error_hint)
{
output_file = ss_output.str();
+ LOG_TRACE(logger) << "Attempting to generate thumbnail using '" << thumbnailer->GetName() << "' thumbnail provider";
+
if (thumbnailer->Run(size_, uri_, output_file, error_hint))
{
error_hint.clear();