Back to index

unity  6.0.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions
unity::dash::TrackPreview Class Reference

#include <MusicPreviews.h>

Inheritance diagram for unity::dash::TrackPreview:
Inheritance graph
[legend]
Collaboration diagram for unity::dash::TrackPreview:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::shared_ptr
< TrackPreview
Ptr
typedef std::vector< std::string > Genres
typedef std::map< std::string,
unity::glib::Variant
Properties

Public Member Functions

 TrackPreview (Preview::Properties &properties)

Static Public Member Functions

static Preview::Ptr PreviewForProperties (std::string const &renderer_name, Properties &properties)

Public Attributes

unsigned int number
std::string title
std::string artist
std::string album
unsigned int length
Genres genres
std::string album_cover
std::string primary_action_name
std::string primary_action_icon_hint
std::string primary_action_uri
std::string play_action_uri
std::string pause_action_uri
std::string renderer_name

Protected Member Functions

unsigned int PropertyToUnsignedInt (Properties &properties, const char *key)
std::string PropertyToString (Properties &properties, const char *key)
std::vector< std::string > PropertyToStringVector (Properties &properties, const char *key)
float PropertyToFloat (Properties &properties, const char *key)

Detailed Description

Definition at line 34 of file MusicPreviews.h.


Member Typedef Documentation

typedef std::vector<std::string> unity::dash::TrackPreview::Genres

Definition at line 38 of file MusicPreviews.h.

typedef std::map<std::string, unity::glib::Variant> unity::dash::Preview::Properties [inherited]

Definition at line 42 of file Preview.h.

typedef std::shared_ptr<TrackPreview> unity::dash::TrackPreview::Ptr

Reimplemented from unity::dash::Preview.

Definition at line 37 of file MusicPreviews.h.


Constructor & Destructor Documentation

Definition at line 27 of file MusicPreviews.cpp.

  : number(PropertyToUnsignedInt(properties, "number"))
  , title(PropertyToString(properties, "title"))
  , artist(PropertyToString(properties, "artist"))
  , album(PropertyToString(properties, "album"))
  , length(PropertyToUnsignedInt(properties, "length"))
  , genres(PropertyToStringVector(properties, "genres"))
  , album_cover(PropertyToString(properties, "album-cover"))
  , primary_action_name(PropertyToString(properties, "primary-action-name"))
  , primary_action_icon_hint(PropertyToString(properties, "primary-action-icon-hint"))
  , primary_action_uri(PropertyToString(properties, "primary-action-uri"))
  , play_action_uri(PropertyToString(properties, "play-action-uri"))
  , pause_action_uri(PropertyToString(properties, "pause-action-uri"))
{
 renderer_name = "preview-track";
}

Member Function Documentation

Preview::Ptr unity::dash::Preview::PreviewForProperties ( std::string const &  renderer_name,
Properties properties 
) [static, inherited]

Definition at line 31 of file Preview.cpp.

{
  if (renderer_name_ == "preview-application")
  {
    return Preview::Ptr(new ApplicationPreview(properties));
  }
  else if (renderer_name_ == "preview-generic")
  {
    return Preview::Ptr(new GenericPreview(properties));
  }
  else if (renderer_name_ == "preview-track")
  {
    return Preview::Ptr(new TrackPreview(properties));
  }
  else if (renderer_name_ == "preview-album")
  {
    return Preview::Ptr(new AlbumPreview(properties));
  }
  else
  {
    return Preview::Ptr(new NoPreview());
  }
}

Here is the caller graph for this function:

float unity::dash::Preview::PropertyToFloat ( Properties properties,
const char *  key 
) [protected, inherited]

Definition at line 90 of file Preview.cpp.

{
  if (properties.find(key) == properties.end())
    return 0.0f;

  return (float)g_variant_get_double(properties[key]);
}
std::string unity::dash::Preview::PropertyToString ( Properties properties,
const char *  key 
) [protected, inherited]

Definition at line 64 of file Preview.cpp.

{
  if (properties.find(key) == properties.end())
   return "";
  return g_variant_get_string(properties[key], NULL);
}
std::vector< std::string > unity::dash::Preview::PropertyToStringVector ( Properties properties,
const char *  key 
) [protected, inherited]

Definition at line 71 of file Preview.cpp.

{
  GVariantIter* iter = NULL;
  char* value = NULL;
  std::vector<std::string> property;

  if (properties.find(key) == properties.end())
    return property;

  g_variant_get(properties[key], "as", &iter);

  while (g_variant_iter_loop(iter, "s", &value))
    property.push_back(value);

  g_variant_iter_free(iter);

  return property;
}
unsigned int unity::dash::Preview::PropertyToUnsignedInt ( Properties properties,
const char *  key 
) [protected, inherited]

Definition at line 59 of file Preview.cpp.

{
  return g_variant_get_uint32(properties[key]);
}

Member Data Documentation

Definition at line 45 of file MusicPreviews.h.

Definition at line 48 of file MusicPreviews.h.

Definition at line 44 of file MusicPreviews.h.

Definition at line 47 of file MusicPreviews.h.

Definition at line 46 of file MusicPreviews.h.

Definition at line 42 of file MusicPreviews.h.

Definition at line 53 of file MusicPreviews.h.

Definition at line 52 of file MusicPreviews.h.

Definition at line 50 of file MusicPreviews.h.

Definition at line 49 of file MusicPreviews.h.

Definition at line 51 of file MusicPreviews.h.

std::string unity::dash::Preview::renderer_name [inherited]

Definition at line 48 of file Preview.h.

Definition at line 43 of file MusicPreviews.h.


The documentation for this class was generated from the following files: