void CGUIDialogAccessPoints::OnInitWindow()
{
  m_wasItemSelected = false;

  CGUIDialog::OnInitWindow();

  CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_ACCESS_POINTS);
  OnMessage(msgReset);

  CStdString ifaceName(m_interfaceName);
  CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
  m_aps = iface->GetAccessPoints();

  for (int i = 0; i < (int) m_aps.size(); i++)
  {
      CFileItem *item = new CFileItem(m_aps[i].getEssId());

      int q = m_aps[i].getQuality();
      if (q <= 20) item->SetThumbnailImage("ap-signal1.png");
      else if (q <= 40) item->SetThumbnailImage("ap-signal2.png");
      else if (q <= 60) item->SetThumbnailImage("ap-signal3.png");
      else if (q <= 80) item->SetThumbnailImage("ap-signal4.png");
      else if (q <= 100) item->SetThumbnailImage("ap-signal5.png");

      if (m_aps[i].getEncryptionMode() != ENC_NONE)
         item->SetIconImage("ap-lock.png");

      CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_ACCESS_POINTS, 0, 0, item);
      OnMessage(msg);
  }

  CFileItem *item = new CFileItem(g_localizeStrings.Get(1047));
  CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_ACCESS_POINTS, 0, 0, item);
  OnMessage(msg);
}
示例#2
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;
}
示例#3
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;
}
示例#4
0
void CGUIWindowVideoInfo::Update()
{
  CStdString strTmp;
  strTmp = m_movieItem->GetVideoInfoTag()->m_strTitle; strTmp.Trim();
  SetLabel(CONTROL_TITLE, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strDirector; strTmp.Trim();
  SetLabel(CONTROL_DIRECTOR, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strStudio; strTmp.Trim();
  SetLabel(CONTROL_STUDIO, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strWritingCredits; strTmp.Trim();
  SetLabel(CONTROL_CREDITS, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strGenre; strTmp.Trim();
  SetLabel(CONTROL_GENRE, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strTagLine; strTmp.Trim();
  SetLabel(CONTROL_TAGLINE, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strPlotOutline; strTmp.Trim();
  SetLabel(CONTROL_PLOTOUTLINE, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strTrailer; strTmp.Trim();
  SetLabel(CONTROL_TRAILER, strTmp);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strMPAARating; strTmp.Trim();
  SetLabel(CONTROL_MPAARATING, strTmp);

  CStdString strTop250;
  if (m_movieItem->GetVideoInfoTag()->m_iTop250)
    strTop250.Format("%i", m_movieItem->GetVideoInfoTag()->m_iTop250);
  SetLabel(CONTROL_TOP250, strTop250);

  CStdString strYear;
  if (m_movieItem->GetVideoInfoTag()->m_iYear)
    strYear.Format("%i", m_movieItem->GetVideoInfoTag()->m_iYear);
  else  
    strYear = g_infoManager.GetItemLabel(m_movieItem,LISTITEM_PREMIERED);
  SetLabel(CONTROL_YEAR, strYear);

  CStdString strRating_And_Votes;
  if (m_movieItem->GetVideoInfoTag()->m_fRating != 0.0f)  // only non-zero ratings are of interest
    strRating_And_Votes.Format("%03.1f (%s %s)", m_movieItem->GetVideoInfoTag()->m_fRating, m_movieItem->GetVideoInfoTag()->m_strVotes, g_localizeStrings.Get(20350));
  SetLabel(CONTROL_RATING_AND_VOTES, strRating_And_Votes);

  strTmp = m_movieItem->GetVideoInfoTag()->m_strRuntime; strTmp.Trim();
  SetLabel(CONTROL_RUNTIME, strTmp);

  // setup plot text area
  strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot;
  if (!(!m_movieItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && m_movieItem->GetVideoInfoTag()->m_iSeason == 0)) // dont apply to tvshows
    if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && g_guiSettings.GetBool("videolibrary.hideplots"))
      strTmp = g_localizeStrings.Get(20370);

  strTmp.Trim();
  SetLabel(CONTROL_TEXTAREA, strTmp);

  // setup cast list + determine type
  ClearCastList();
  if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty())
  { // music video
    CStdStringArray artists;
    StringUtils::SplitString(m_movieItem->GetVideoInfoTag()->m_strArtist, g_advancedSettings.m_videoItemSeparator, artists);
    for (std::vector<CStdString>::const_iterator it = artists.begin(); it != artists.end(); ++it)
    {
      CFileItem *item = new CFileItem(*it);
      if (CFile::Exists(item->GetCachedArtistThumb()))
        item->SetThumbnailImage(item->GetCachedArtistThumb());
      item->SetIconImage("DefaultArtist.png");
      m_castList->Add(item);
    }
    m_castList->SetContent("musicvideos");
  }
  else
  { // movie/show/episode
    for (CVideoInfoTag::iCast it = m_movieItem->GetVideoInfoTag()->m_cast.begin(); it != m_movieItem->GetVideoInfoTag()->m_cast.end(); ++it)
    {
      CStdString character;
      if (it->strRole.IsEmpty())
        character = it->strName;
      else
        character.Format("%s %s %s", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
      CFileItem *item = new CFileItem(it->strName);
      if (CFile::Exists(item->GetCachedActorThumb()))
        item->SetThumbnailImage(item->GetCachedActorThumb());
      item->SetIconImage("DefaultActor.png");
      item->SetLabel(character);
      m_castList->Add(item);
    }
    // determine type:
    if (m_movieItem->m_bIsFolder)
      m_castList->SetContent("tvshows");
    else if (m_movieItem->GetVideoInfoTag()->m_iSeason > -1)
      m_castList->SetContent("episodes");
    else
      m_castList->SetContent("movies");
  }
  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST, 0, 0, m_castList);
  OnMessage(msg);

  if (m_bViewReview)
  {
    if (!m_movieItem->GetVideoInfoTag()->m_strArtist.IsEmpty())
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 133);
    }
    else
    {
      SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 206);
    }

    SET_CONTROL_HIDDEN(CONTROL_LIST);
    SET_CONTROL_VISIBLE(CONTROL_TEXTAREA);
  }
  else
  {
    SET_CONTROL_LABEL(CONTROL_BTN_TRACKS, 207);

    SET_CONTROL_HIDDEN(CONTROL_TEXTAREA);
    SET_CONTROL_VISIBLE(CONTROL_LIST);
  }

  // Check for resumability
  CGUIWindowVideoFiles *window = (CGUIWindowVideoFiles *)m_gWindowManager.GetWindow(WINDOW_VIDEO_FILES);
  if (window && window->GetResumeItemOffset(m_movieItem) > 0)
  {
    CONTROL_ENABLE(CONTROL_BTN_RESUME);
  }
  else
  {
    CONTROL_DISABLE(CONTROL_BTN_RESUME);
  }

  if (m_movieItem->GetVideoInfoTag()->m_strEpisodeGuide.IsEmpty()) // disable the play button for tv show info
  {
    CONTROL_ENABLE(CONTROL_BTN_PLAY)
  }
  else
  {
    CONTROL_DISABLE(CONTROL_BTN_PLAY)
  }

  // update the thumbnail
  const CGUIControl* pControl = GetControl(CONTROL_IMAGE);
  if (pControl)
  {
    CGUIImage* pImageControl = (CGUIImage*)pControl;
    pImageControl->FreeResources();
    pImageControl->SetFileName(m_movieItem->GetThumbnailImage());
  }
}