void CGUIWindowVideoNav::UpdateButtons() { CGUIWindowVideoBase::UpdateButtons(); // Update object count int iItems = m_vecItems->Size(); if (iItems) { // check for parent dir and "all" items // should always be the first two items for (int i = 0; i <= (iItems>=2 ? 1 : 0); i++) { CFileItemPtr pItem = m_vecItems->Get(i); if (pItem->IsParentFolder()) iItems--; if (pItem->m_strPath.Left(4).Equals("/-1/")) iItems--; } // or the last item if (m_vecItems->Size() > 2 && m_vecItems->Get(m_vecItems->Size()-1)->m_strPath.Left(4).Equals("/-1/")) iItems--; } CStdString items; items.Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); // set the filter label CStdString strLabel; // "Playlists" if (m_vecItems->m_strPath.Equals("special://videoplaylists/")) strLabel = g_localizeStrings.Get(136); // "{Playlist Name}" else if (m_vecItems->IsPlayList()) { // get playlist name from path CStdString strDummy; URIUtils::Split(m_vecItems->m_strPath, strDummy, strLabel); } else if (m_vecItems->m_strPath.Equals("sources://video/")) strLabel = g_localizeStrings.Get(744); // everything else is from a videodb:// path else if (m_vecItems->IsVideoDb()) { CVideoDatabaseDirectory dir; dir.GetLabel(m_vecItems->m_strPath, strLabel); } else strLabel = URIUtils::GetFileName(m_vecItems->m_strPath); SET_CONTROL_LABEL(CONTROL_FILTER, strLabel); int watchMode = g_settings.GetWatchMode(m_vecItems->GetContent()); SET_CONTROL_LABEL(CONTROL_BTNSHOWMODE, g_localizeStrings.Get(16100 + watchMode)); SET_CONTROL_SELECTED(GetID(), CONTROL_BTNSHOWALL, watchMode != VIDEO_SHOW_ALL); SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled()); SET_CONTROL_SELECTED(GetID(),CONTROL_BTNFLATTEN, g_settings.m_bMyVideoNavFlatten); }
void CGUIWindowVideoNav::UpdateButtons() { CGUIWindowVideoBase::UpdateButtons(); // Update object count int iItems = m_vecItems->Size(); if (iItems) { // check for parent dir and "all" items // should always be the first two items for (int i = 0; i <= (iItems>=2 ? 1 : 0); i++) { CFileItemPtr pItem = m_vecItems->Get(i); if (pItem->IsParentFolder()) iItems--; if (StringUtils::StartsWith(pItem->GetPath(), "/-1/")) iItems--; } // or the last item if (m_vecItems->Size() > 2 && StringUtils::StartsWith(m_vecItems->Get(m_vecItems->Size()-1)->GetPath(), "/-1/")) iItems--; } std::string items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); // set the filter label std::string strLabel; // "Playlists" if (m_vecItems->IsPath("special://videoplaylists/")) strLabel = g_localizeStrings.Get(136); // "{Playlist Name}" else if (m_vecItems->IsPlayList()) { // get playlist name from path std::string strDummy; URIUtils::Split(m_vecItems->GetPath(), strDummy, strLabel); } else if (m_vecItems->IsPath("sources://video/")) strLabel = g_localizeStrings.Get(744); // everything else is from a videodb:// path else if (m_vecItems->IsVideoDb()) { CVideoDatabaseDirectory dir; dir.GetLabel(m_vecItems->GetPath(), strLabel); } else strLabel = URIUtils::GetFileName(m_vecItems->GetPath()); SET_CONTROL_LABEL(CONTROL_FILTER, strLabel); int watchMode = CMediaSettings::GetInstance().GetWatchedMode(m_vecItems->GetContent()); SET_CONTROL_LABEL(CONTROL_BTNSHOWMODE, g_localizeStrings.Get(16100 + watchMode)); SET_CONTROL_SELECTED(GetID(), CONTROL_BTNSHOWALL, watchMode != WatchedModeAll); SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled()); CONTROL_ENABLE_ON_CONDITION(CONTROL_UPDATE_LIBRARY, !m_vecItems->IsAddonsPath() && !m_vecItems->IsPlugin() && !m_vecItems->IsScript()); }