Back to index

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

#include <ApplicationPreview.h>

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

List of all members.

Public Types

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

Public Member Functions

 ApplicationPreview (Preview::Properties &properties)

Static Public Member Functions

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

Public Attributes

std::string name
std::string version
std::string size
std::string license
std::string last_updated
float rating
uint n_ratings
std::string description
std::string icon_hint
std::string screenshot_icon_hint
std::string primary_action_name
std::string primary_action_icon_hint
std::string primary_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 ApplicationPreview.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 ApplicationPreview.h.


Constructor & Destructor Documentation

Definition at line 27 of file ApplicationPreview.cpp.

  : name(PropertyToString(properties, "name"))
  , version(PropertyToString(properties, "version"))
  , size(PropertyToString(properties, "size"))
  , license(PropertyToString(properties, "license"))
  , last_updated(PropertyToString(properties, "last-updated"))
  , rating(PropertyToFloat(properties, "rating"))
  , n_ratings(PropertyToUnsignedInt(properties, "n-ratings"))
  , description(PropertyToString(properties, "string"))
  , icon_hint(PropertyToString(properties, "icon-hint"))
  , screenshot_icon_hint(PropertyToString(properties, "screenshot-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"))
{
 renderer_name = "preview-application";
}

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 48 of file ApplicationPreview.h.

Definition at line 49 of file ApplicationPreview.h.

Definition at line 45 of file ApplicationPreview.h.

Definition at line 44 of file ApplicationPreview.h.

Definition at line 47 of file ApplicationPreview.h.

Definition at line 41 of file ApplicationPreview.h.

Definition at line 52 of file ApplicationPreview.h.

Definition at line 51 of file ApplicationPreview.h.

Definition at line 53 of file ApplicationPreview.h.

Definition at line 46 of file ApplicationPreview.h.

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

Definition at line 48 of file Preview.h.

Definition at line 50 of file ApplicationPreview.h.

Definition at line 43 of file ApplicationPreview.h.

Definition at line 42 of file ApplicationPreview.h.


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