本文整理汇总了C++中CFileItemPtr::GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::GetProperty方法的具体用法?C++ CFileItemPtr::GetProperty怎么用?C++ CFileItemPtr::GetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::GetProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CGUIWindowAddonBrowser::SetItemLabel2(CFileItemPtr item)
{
if (!item || item->m_bIsFolder) return;
unsigned int percent;
if (CAddonInstaller::GetInstance().GetProgress(item->GetProperty("Addon.ID").asString(), percent))
{
std::string progress = StringUtils::Format(g_localizeStrings.Get(24042).c_str(), percent);
item->SetProperty("Addon.Status", progress);
item->SetProperty("Addon.Downloading", true);
}
else
item->ClearProperty("Addon.Downloading");
item->SetLabel2(item->GetProperty("Addon.Status").asString());
// to avoid the view state overriding label 2
item->SetLabelPreformated(true);
}
示例2: GetDirectory
bool CGUIWindowEventLog::GetDirectory(const std::string &strDirectory, CFileItemList &items)
{
bool result = CGUIMediaWindow::GetDirectory(strDirectory, items);
EventLevel currentLevel = CViewStateSettings::GetInstance().GetEventLevel();
bool showHigherLevels = CViewStateSettings::GetInstance().ShowHigherEventLevels();
CFileItemList filteredItems(items.GetPath());
for (int i = 0; i < items.Size(); i++)
{
CFileItemPtr item = items.Get(i);
if (item->IsParentFolder())
{
filteredItems.Add(item);
continue;
}
if (!item->HasProperty(PROPERTY_EVENT_LEVEL))
continue;
EventLevel level = CEventLog::GetInstance().EventLevelFromString(item->GetProperty(PROPERTY_EVENT_LEVEL).asString());
if (level == currentLevel ||
(level > currentLevel && showHigherLevels))
filteredItems.Add(item);
}
items.ClearItems();
items.Append(filteredItems);
return result;
}
示例3: SetData
void CGUIDialogPVRChannelManager::SetData(int iItem)
{
CGUIEditControl *pEdit;
CGUIRadioButtonControl *pRadioButton;
/* Check file item is in list range and get his pointer */
if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return;
CFileItemPtr pItem = m_channelItems->Get(iItem);
if (!pItem)
return;
// CPVRChannel *infotag = pItem->GetPVRChannelInfoTag();
pEdit = (CGUIEditControl *)GetControl(EDIT_NAME);
if (pEdit)
{
pEdit->SetLabel2(pItem->GetProperty("Name"));
pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, 19208);
}
pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_ACTIVE);
if (pRadioButton) pRadioButton->SetSelected(pItem->GetPropertyBOOL("ActiveChannel"));
pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_USEEPG);
if (pRadioButton) pRadioButton->SetSelected(pItem->GetPropertyBOOL("UseEPG"));
}
示例4: OnClickButtonDeleteChannel
bool CGUIDialogPVRChannelManager::OnClickButtonDeleteChannel(CGUIMessage &message)
{
CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
if (!pItem)
return false;
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
if (!pDialog)
return true;
pDialog->SetHeading(19211);
pDialog->SetLine(0, "");
pDialog->SetLine(1, 750);
pDialog->SetLine(2, "");
pDialog->DoModal();
if (pDialog->IsConfirmed())
{
if (pItem->GetProperty("Virtual").asBoolean())
{
pItem->GetPVRChannelInfoTag()->SetVirtual(true);
m_channelItems->Remove(m_iSelected);
m_viewControl.SetItems(*m_channelItems);
Renumber();
return true;
}
CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
}
return true;
}
示例5: OnClick
bool CGUIControlListSetting::OnClick()
{
if (m_pButton == NULL)
return false;
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (dialog == NULL)
return false;
CFileItemList options;
if (!GetItems(m_pSetting, options) || options.Size() <= 1)
return false;
const CSettingControlList *control = static_cast<const CSettingControlList*>(m_pSetting->GetControl());
dialog->Reset();
dialog->SetHeading(g_localizeStrings.Get(m_pSetting->GetLabel()));
dialog->SetItems(&options);
dialog->SetMultiSelection(control->CanMultiSelect());
dialog->DoModal();
if (!dialog->IsConfirmed())
return false;
const CFileItemList &items = dialog->GetSelectedItems();
std::vector<CVariant> values;
for (int index = 0; index < items.Size(); index++)
{
const CFileItemPtr item = items[index];
if (item == NULL || !item->HasProperty("value"))
return false;
values.push_back(item->GetProperty("value"));
}
bool ret = false;
switch (m_pSetting->GetType())
{
case SettingTypeInteger:
if (values.size() > 1)
return false;
ret = ((CSettingInt *)m_pSetting)->SetValue((int)values.at(0).asInteger());
case SettingTypeString:
if (values.size() > 1)
return false;
ret = ((CSettingString *)m_pSetting)->SetValue(values.at(0).asString());
case SettingTypeList:
ret = CSettings::Get().SetList(m_pSetting->GetId(), values);
default:
break;
}
if (ret)
Update();
return ret;
}
示例6: OnContextButton
bool CGUIWindowAddonBrowser::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
std::string addonId = pItem->GetProperty("Addon.ID").asString();
if (!addonId.empty())
{
if (button == CONTEXT_BUTTON_INFO)
{
return CGUIDialogAddonInfo::ShowForItem(pItem);
}
else if (button == CONTEXT_BUTTON_SETTINGS)
{
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(addonId, addon, ADDON_UNKNOWN, false))
return CGUIDialogAddonSettings::ShowAndGetInput(addon);
}
else if (button == CONTEXT_BUTTON_CHECK_FOR_UPDATES)
{
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(addonId, addon, ADDON_REPOSITORY))
CRepositoryUpdater::GetInstance().CheckForUpdates(std::static_pointer_cast<CRepository>(addon), true);
}
}
return CGUIMediaWindow::OnContextButton(itemNumber, button);
}
示例7: OnPopupMenu
bool CGUIDialogPVRChannelManager::OnPopupMenu(int iItem)
{
// popup the context menu
// grab our context menu
CContextButtons buttons;
// mark the item
if (iItem >= 0 && iItem < m_channelItems->Size())
m_channelItems->Get(iItem)->Select(true);
else
return false;
CFileItemPtr pItem = m_channelItems->Get(iItem);
if (!pItem)
return false;
buttons.Add(CONTEXT_BUTTON_MOVE, 116); /* Move channel up or down */
if (pItem->GetProperty("Virtual").asBoolean())
buttons.Add(CONTEXT_BUTTON_EDIT_SOURCE, 1027); /* Edit virtual channel URL */
int choice = CGUIDialogContextMenu::ShowAndGetChoice(buttons);
// deselect our item
if (iItem >= 0 && iItem < m_channelItems->Size())
m_channelItems->Get(iItem)->Select(false);
if (choice < 0)
return false;
return OnContextButton(iItem, (CONTEXT_BUTTON)choice);
}
示例8: GenerateListing
void CAddonsDirectory::GenerateListing(CURL &path, VECADDONS& addons, CFileItemList &items, bool reposAsFolders)
{
CStdString xbmcPath = _P("special://xbmc/addons");
items.ClearItems();
for (unsigned i=0; i < addons.size(); i++)
{
AddonPtr addon = addons[i];
CFileItemPtr pItem;
if (reposAsFolders && addon->Type() == ADDON_REPOSITORY)
pItem = FileItemFromAddon(addon, "addons://", true);
else
pItem = FileItemFromAddon(addon, path.Get(), false);
AddonPtr addon2;
if (CAddonMgr::Get().GetAddon(addon->ID(),addon2))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(305));
else if ((addon->Type() == ADDON_PVRDLL) && (CStdString(pItem->GetProperty("Addon.Path").asString()).Left(xbmcPath.size()).Equals(xbmcPath)))
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24023));
if (!addon->Props().broken.IsEmpty())
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24098));
if (addon2 && addon2->Version() < addon->Version())
{
pItem->SetProperty("Addon.Status",g_localizeStrings.Get(24068));
pItem->SetProperty("Addon.UpdateAvail", true);
}
CAddonDatabase::SetPropertiesFromAddon(addon,pItem);
items.Add(pItem);
}
}
示例9: GetContextButtons
void CGUIWindowGames::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item = m_vecItems->Get(itemNumber);
if (item && !item->GetProperty("pluginreplacecontextitems").asBoolean())
{
if (m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->IsSourcesPath())
{
// Context buttons for a sources path, like "Add source", "Remove Source", etc.
CGUIDialogContextMenu::GetContextButtons("games", item, buttons);
}
else
{
if (item->IsGame())
{
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 208); // Play
}
if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_FILELISTS_ALLOWFILEDELETION) && !item->IsReadOnly())
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
示例10: OnClickButtonChannelLogo
bool CGUIDialogPVRChannelManager::OnClickButtonChannelLogo(CGUIMessage &message)
{
CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
if (!pItem)
return false;
if (g_settings.GetCurrentProfile().canWriteSources() && !g_passwordManager.IsProfileLockUnlocked())
return false;
else if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
// setup our thumb list
CFileItemList items;
// add the current thumb, if available
if (!pItem->GetProperty("Icon").asString().empty())
{
CFileItemPtr current(new CFileItem("thumb://Current", false));
current->SetArt("thumb", pItem->GetPVRChannelInfoTag()->IconPath());
current->SetLabel(g_localizeStrings.Get(20016));
items.Add(current);
}
else if (pItem->HasArt("thumb"))
{ // already have a thumb that the share doesn't know about - must be a local one, so we mayaswell reuse it.
CFileItemPtr current(new CFileItem("thumb://Current", false));
current->SetArt("thumb", pItem->GetArt("thumb"));
current->SetLabel(g_localizeStrings.Get(20016));
items.Add(current);
}
// and add a "no thumb" entry as well
CFileItemPtr nothumb(new CFileItem("thumb://None", false));
nothumb->SetIconImage(pItem->GetIconImage());
nothumb->SetLabel(g_localizeStrings.Get(20018));
items.Add(nothumb);
CStdString strThumb;
VECSOURCES shares;
if (g_guiSettings.GetString("pvrmenu.iconpath") != "")
{
CMediaSource share1;
share1.strPath = g_guiSettings.GetString("pvrmenu.iconpath");
share1.strName = g_localizeStrings.Get(19018);
shares.push_back(share1);
}
g_mediaManager.GetLocalDrives(shares);
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb))
return false;
if (strThumb == "thumb://Current")
return true;
if (strThumb == "thumb://None")
strThumb = "";
pItem->SetProperty("Icon", strThumb);
pItem->SetProperty("Changed", true);
m_bContainsChanges = true;
return true;
}
示例11: OnClickButtonEditChannel
bool CGUIDialogPVRChannelManager::OnClickButtonEditChannel(CGUIMessage &message)
{
CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
if (!pItem)
return false;
if (pItem->GetProperty("Virtual").asBoolean())
{
CStdString strURL = pItem->GetProperty("StreamURL").asString();
if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
pItem->SetProperty("StreamURL", strURL);
return true;
}
CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
return true;
}
示例12: SetData
void CGUIDialogPVRChannelManager::SetData(int iItem)
{
/* Check file item is in list range and get his pointer */
if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return;
CFileItemPtr pItem = m_channelItems->Get(iItem);
if (!pItem)
return;
SET_CONTROL_LABEL2(EDIT_NAME, pItem->GetProperty("Name").asString());
CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), EDIT_NAME, CGUIEditControl::INPUT_TYPE_TEXT, 19208);
OnMessage(msg);
SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_ACTIVE, pItem->GetProperty("ActiveChannel").asBoolean());
SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_USEEPG, pItem->GetProperty("UseEPG").asBoolean());
SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_PARENTAL_LOCK, pItem->GetProperty("ParentalLocked").asBoolean());
}
示例13: GotoBookmark
void CGUIDialogVideoBookmarks::GotoBookmark(int item)
{
if (item < 0 || item >= m_vecItems->Size() || !g_application.m_pPlayer->HasPlayer())
return;
CFileItemPtr fileItem = m_vecItems->Get(item);
int chapter = static_cast<int>(fileItem->GetProperty("chapter").asInteger());
if (chapter <= 0)
{
g_application.m_pPlayer->SetPlayerState(fileItem->GetProperty("playerstate").asString());
g_application.SeekTime(fileItem->GetProperty("resumepoint").asDouble());
}
else
g_application.m_pPlayer->SeekChapter(chapter);
Close();
}
示例14: OnClick
bool CGUIWindowAddonBrowser::OnClick(int iItem)
{
CFileItemPtr item = m_vecItems->Get(iItem);
if (item->GetPath() == "addons://install/")
{
// pop up filebrowser to grab an installed folder
VECSOURCES shares = *CMediaSourceSettings::Get().GetSources("files");
g_mediaManager.GetLocalDrives(shares);
g_mediaManager.GetNetworkLocations(shares);
CStdString path;
if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "*.zip", g_localizeStrings.Get(24041), path))
CAddonInstaller::Get().InstallFromZip(path);
return true;
}
if (item->GetPath() == "addons://update_all/")
{
// fire off a threaded update of all addons
UpdateAddons updater;
if (CGUIDialogBusy::Wait(&updater))
return Update("addons://downloading/");
return true;
}
if (!item->m_bIsFolder)
{
// cancel a downloading job
if (item->HasProperty("Addon.Downloading"))
{
if (CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(24000),
item->GetProperty("Addon.Name").asString(),
g_localizeStrings.Get(24066),""))
{
if (CAddonInstaller::Get().Cancel(item->GetProperty("Addon.ID").asString()))
Refresh();
}
return true;
}
CGUIDialogAddonInfo::ShowForItem(item);
return true;
}
if (item->GetPath().Equals("addons://search/"))
return Update(item->GetPath());
return CGUIMediaWindow::OnClick(iItem);
}
示例15: OnContextButton
bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
/* Check file item is in list range and get his pointer */
if (itemNumber < 0 || itemNumber >= (int)m_channelItems->Size()) return false;
CFileItemPtr pItem = m_channelItems->Get(itemNumber);
if (!pItem)
return false;
if (button == CONTEXT_BUTTON_MOVE)
{
m_bMovingMode = true;
pItem->Select(true);
}
else if (button == CONTEXT_BUTTON_SETTINGS)
{
PVR_ERROR ret = CServiceBroker::GetPVRManager().Clients()->OpenDialogChannelSettings(pItem->GetPVRChannelInfoTag());
if (ret == PVR_ERROR_NOT_IMPLEMENTED)
CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend."
else if (ret != PVR_ERROR_NO_ERROR)
CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message."
}
else if (button == CONTEXT_BUTTON_DELETE)
{
CGUIDialogYesNo* pDialog = g_windowManager.GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);
if (!pDialog)
return true;
pDialog->SetHeading(CVariant{19211}); // Delete channel
pDialog->SetText(CVariant{750}); // Are you sure?
pDialog->Open();
if (pDialog->IsConfirmed())
{
CPVRChannelPtr channel = pItem->GetPVRChannelInfoTag();
PVR_ERROR ret = CServiceBroker::GetPVRManager().Clients()->DeleteChannel(channel);
if (ret == PVR_ERROR_NO_ERROR)
{
CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAll(channel->IsRadio())->RemoveFromGroup(channel);
m_channelItems->Remove(m_iSelected);
m_viewControl.SetItems(*m_channelItems);
Renumber();
}
else if (ret == PVR_ERROR_NOT_IMPLEMENTED)
CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19038}); // "Information", "Not supported by the PVR backend."
else
CGUIDialogOK::ShowAndGetInput(CVariant{2103}, CVariant{16029}); // "Add-on error", "Check the log for more information about this message."
}
}
else if (button == CONTEXT_BUTTON_EDIT_SOURCE)
{
std::string strURL = pItem->GetProperty("StreamURL").asString();
if (CGUIKeyboardFactory::ShowAndGetInput(strURL, CVariant{g_localizeStrings.Get(19214)}, false))
pItem->SetProperty("StreamURL", strURL);
}
return true;
}