当前位置: 首页>>代码示例>>C++>>正文


C++ CFileItem::SetLabel2方法代码示例

本文整理汇总了C++中CFileItem::SetLabel2方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::SetLabel2方法的具体用法?C++ CFileItem::SetLabel2怎么用?C++ CFileItem::SetLabel2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileItem的用法示例。


在下文中一共展示了CFileItem::SetLabel2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateFileItem

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;
}
开发者ID:Elzevir,项目名称:xbmc,代码行数:30,代码来源:SavestateDatabase.cpp

示例2: LoadContent

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;
}
开发者ID:jeppster,项目名称:xbmc-fork,代码行数:77,代码来源:GUIBaseContainer.cpp


注:本文中的CFileItem::SetLabel2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。