Ejemplo n.º 1
0
CFileItem* CSavestateDatabase::CreateFileItem(const CVariant& object) const
{
  using namespace ADDON;

  CSavestate save;
  save.Deserialize(object);
  CFileItem* item = new CFileItem(save.Label());

  item->SetPath(save.Path());
  if (!save.Thumbnail().empty())
    item->SetArt("thumb", save.Thumbnail());
  else
  {
    AddonPtr addon;
    if (CAddonMgr::GetInstance().GetAddon(save.GameClient(), addon, ADDON_GAMEDLL))
      item->SetArt("thumb", addon->Icon());
  }

  // Use the slot number as the second label
  if (save.Type() == SAVETYPE::SLOT)
    item->SetLabel2(StringUtils::Format("%u", save.Slot()));

  item->m_dateTime = save.Timestamp();
  item->SetProperty(FILEITEM_PROPERTY_SAVESTATE_DURATION, static_cast<uint64_t>(save.PlaytimeWallClock()));
  item->GetGameInfoTag()->SetGameClient(save.GameClient());
  item->m_dwSize = save.Size();
  item->m_bIsFolder = false;

  return item;
}
Ejemplo n.º 2
0
CFileItem *CGUIDialogAudioDSPManager::helper_CreateModeListItem(CActiveAEDSPModePtr &ModePointer, AE_DSP_MENUHOOK_CAT &MenuHook, int *ContinuesNo)
{
    CFileItem *pItem = NULL;

    if (!ContinuesNo)
    {
        return pItem;
    }

    // start to get Addon and Mode properties
    const int AddonID = ModePointer->AddonID();

    std::string addonName;
    if (!CServiceBroker::GetADSP().GetAudioDSPAddonName(AddonID, addonName))
    {
        return pItem;
    }

    AE_DSP_ADDON addon;
    if (!CServiceBroker::GetADSP().GetAudioDSPAddon(AddonID, addon))
    {
        return pItem;
    }

    std::string modeName = g_localizeStrings.GetAddonString(addon->ID(), ModePointer->ModeName());

    std::string description;
    if (ModePointer->ModeDescription() > -1)
    {
        description = g_localizeStrings.GetAddonString(addon->ID(), ModePointer->ModeDescription());
    }
    else
    {
        description = g_localizeStrings.Get(15063);
    }

    bool isActive = ModePointer->IsEnabled();
    int number = ModePointer->ModePosition();
    int dialogId = helper_GetDialogId(ModePointer, MenuHook, addon, addonName);
    // end to get Addon and Mode properties

    if (isActive)
    {
        if (number <= 0)
        {
            number = *ContinuesNo;
            (*ContinuesNo)++;
        }

        std::string str = StringUtils::Format("%i:%i:%i:%s",
                                              number,
                                              AddonID,
                                              ModePointer->AddonModeNumber(),
                                              ModePointer->AddonModeName().c_str());

        pItem = new CFileItem(str);
    }
    else
    {
        pItem = new CFileItem(modeName);
    }

    // set list item properties
    pItem->SetProperty("ActiveMode", isActive);
    pItem->SetProperty("Number", number);
    pItem->SetLabel(modeName);
    pItem->SetProperty("Description", description);
    pItem->SetProperty("Help", ModePointer->ModeHelp());
    if (ModePointer->IconOwnModePath().empty())
        pItem->SetIconImage("DefaultAddonAudioDSP.png");
    else
        pItem->SetIconImage(ModePointer->IconOwnModePath());
    pItem->SetProperty("SettingsDialog", dialogId);
    pItem->SetProperty("AddonId", AddonID);
    pItem->SetProperty("AddonModeNumber", ModePointer->AddonModeNumber());
    pItem->SetLabel2(addonName);
    pItem->SetProperty("Changed", false);

    return pItem;
}
Ejemplo n.º 3
0
void CGUIBaseContainer::LoadContent(TiXmlElement *content)
{
    TiXmlElement *root = content->FirstChildElement("content");
    if (!root)
        return;

    g_SkinInfo.ResolveIncludes(root);

    m_staticContent = true;
    TiXmlElement *item = root->FirstChildElement("item");
    while (item)
    {
        // format:
        // <item label="Cool Video" label2="" thumb="q:\userdata\thumbnails\video\04385918.tbn">PlayMedia(c:\videos\cool_video.avi)</item>
        // <item label="My Album" label2="" thumb="q:\userdata\thumbnails\music\0\04385918.tbn">ActivateWindow(MyMusic,c:\music\my album)</item>
        // <item label="Apple Movie Trailers" label2="Bob" thumb="q:\userdata\thumbnails\programs\04385918.tbn">RunScript(q:\scripts\apple movie trailers\default.py)</item>

        // OR the more verbose, but includes-friendly:
        // <item>
        //   <label>blah</label>
        //   <label2>foo</label2>
        //   <thumb>bar.png</thumb>
        //   <icon>foo.jpg</icon>
        //   <onclick>ActivateWindow(Home)</onclick>
        // </item>
        g_SkinInfo.ResolveIncludes(item);
        if (item->FirstChild())
        {
            CFileItem *newItem = NULL;
            // check whether we're using the more verbose method...
            TiXmlNode *click = item->FirstChild("onclick");
            if (click && click->FirstChild())
            {
                CStdString label, label2, thumb, icon;
                XMLUtils::GetString(item, "label", label);
                XMLUtils::GetString(item, "label2", label2);
                XMLUtils::GetString(item, "thumb", thumb);
                XMLUtils::GetString(item, "icon", icon);
                const char *id = item->Attribute("id");
                int visibleCondition = 0;
                CGUIControlFactory::GetConditionalVisibility(item, visibleCondition);
                newItem = new CFileItem(CGUIControlFactory::FilterLabel(label));
                // multiple action strings are concat'd together, separated with " , "
                vector<CStdString> actions;
                CGUIControlFactory::GetMultipleString(item, "onclick", actions);
                for (vector<CStdString>::iterator it = actions.begin(); it != actions.end(); ++it)
                    (*it).Replace(",", ",,");
                StringUtils::JoinString(actions, " , ", newItem->m_strPath);
                newItem->SetLabel2(CGUIControlFactory::FilterLabel(label2));
                newItem->SetThumbnailImage(thumb);
                newItem->SetIconImage(icon);
                if (id) newItem->m_iprogramCount = atoi(id);
                newItem->m_idepth = visibleCondition;
            }
            else
            {
                const char *label = item->Attribute("label");
                const char *label2 = item->Attribute("label2");
                const char *thumb = item->Attribute("thumb");
                const char *icon = item->Attribute("icon");
                const char *id = item->Attribute("id");
                newItem = new CFileItem(label ? CGUIControlFactory::FilterLabel(label) : "");
                newItem->m_strPath = item->FirstChild()->Value();
                if (label2) newItem->SetLabel2(CGUIControlFactory::FilterLabel(label2));
                if (thumb) newItem->SetThumbnailImage(thumb);
                if (icon) newItem->SetIconImage(icon);
                if (id) newItem->m_iprogramCount = atoi(id);
                newItem->m_idepth = 0;  // no visibility condition
            }
            m_staticItems.push_back(newItem);
        }
        item = item->NextSiblingElement("item");
    }
    // and make sure m_items is setup initially as well, so that initial item selection works as expected
    UpdateVisibility();
    return;
}