Back to index

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

#include <GenericPreview.h>

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

List of all members.

Public Types

typedef std::shared_ptr
< GenericPreview
Ptr
typedef std::map< std::string,
unity::glib::Variant
Properties

Public Member Functions

 GenericPreview (Preview::Properties &properties)

Static Public Member Functions

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

Public Attributes

std::string name
unsigned int date_modified
unsigned int size
std::string type
std::string description
std::string icon_hint
std::string primary_action_name
std::string primary_action_icon_hint
std::string primary_action_uri
std::string secondary_action_name
std::string secondary_action_icon_hint
std::string secondary_action_uri
std::string tertiary_action_name
std::string tertiary_action_icon_hint
std::string tertiary_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 GenericPreview.h.


Member Typedef Documentation

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

Definition at line 42 of file Preview.h.

Reimplemented from unity::dash::Preview.

Definition at line 37 of file GenericPreview.h.


Constructor & Destructor Documentation

Definition at line 27 of file GenericPreview.cpp.

  : name(PropertyToString(properties, "name"))
  , date_modified(PropertyToUnsignedInt(properties, "date-modified"))
  , size(PropertyToUnsignedInt(properties, "size"))
  , type(PropertyToString(properties, "type"))
  , description(PropertyToString(properties, "string"))
  , icon_hint(PropertyToString(properties, "icon-hint"))
  , 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"))
  , secondary_action_name(PropertyToString(properties, "secondary-action-name"))
  , secondary_action_icon_hint(PropertyToString(properties, "secondary-action-icon-hint"))
  , secondary_action_uri(PropertyToString(properties, "secondary-action-uri"))
  , tertiary_action_name(PropertyToString(properties, "tertiary-action-name"))
  , tertiary_action_icon_hint(PropertyToString(properties, "tertiary-action-icon-hint"))
  , tertiary_action_uri(PropertyToString(properties, "tertiary-action-uri"))
{
 renderer_name = "preview-generic";
}

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 42 of file GenericPreview.h.

Definition at line 45 of file GenericPreview.h.

Definition at line 46 of file GenericPreview.h.

Definition at line 41 of file GenericPreview.h.

Definition at line 48 of file GenericPreview.h.

Definition at line 47 of file GenericPreview.h.

Definition at line 49 of file GenericPreview.h.

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

Definition at line 48 of file Preview.h.

Definition at line 51 of file GenericPreview.h.

Definition at line 50 of file GenericPreview.h.

Definition at line 52 of file GenericPreview.h.

Definition at line 43 of file GenericPreview.h.

Definition at line 54 of file GenericPreview.h.

Definition at line 53 of file GenericPreview.h.

Definition at line 55 of file GenericPreview.h.

Definition at line 44 of file GenericPreview.h.


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