本文整理汇总了C++中CGUIDialogSelect::SetUseDetails方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogSelect::SetUseDetails方法的具体用法?C++ CGUIDialogSelect::SetUseDetails怎么用?C++ CGUIDialogSelect::SetUseDetails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogSelect
的用法示例。
在下文中一共展示了CGUIDialogSelect::SetUseDetails方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChooseArtType
string CGUIDialogVideoInfo::ChooseArtType(const CFileItem &videoItem, map<string, string> ¤tArt)
{
// prompt for choice
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!dialog || !videoItem.HasVideoInfoTag())
return "";
CFileItemList items;
dialog->SetHeading(13511);
dialog->Reset();
dialog->SetUseDetails(true);
dialog->EnableButton(true, 13516);
CVideoDatabase db;
db.Open();
vector<string> artTypes = CVideoThumbLoader::GetArtTypes(videoItem.GetVideoInfoTag()->m_type);
// add in any stored art for this item that is non-empty.
db.GetArtForItem(videoItem.GetVideoInfoTag()->m_iDbId, videoItem.GetVideoInfoTag()->m_type, currentArt);
for (CGUIListItem::ArtMap::iterator i = currentArt.begin(); i != currentArt.end(); ++i)
{
if (!i->second.empty() && find(artTypes.begin(), artTypes.end(), i->first) == artTypes.end())
artTypes.push_back(i->first);
}
// add any art types that exist for other media items of the same type
vector<string> dbArtTypes;
db.GetArtTypes(videoItem.GetVideoInfoTag()->m_type, dbArtTypes);
for (vector<string>::const_iterator it = dbArtTypes.begin(); it != dbArtTypes.end(); it++)
{
if (find(artTypes.begin(), artTypes.end(), *it) == artTypes.end())
artTypes.push_back(*it);
}
for (vector<string>::const_iterator i = artTypes.begin(); i != artTypes.end(); ++i)
{
string type = *i;
CFileItemPtr item(new CFileItem(type, "false"));
item->SetLabel(type);
if (videoItem.HasArt(type))
item->SetArt("thumb", videoItem.GetArt(type));
items.Add(item);
}
dialog->SetItems(&items);
dialog->DoModal();
if (dialog->IsButtonPressed())
{
// Get the new artwork name
CStdString strArtworkName;
if (!CGUIKeyboardFactory::ShowAndGetInput(strArtworkName, g_localizeStrings.Get(13516), false))
return "";
return strArtworkName;
}
return dialog->GetSelectedItem()->GetLabel();
}
示例2:
CGUIDialogSelect *CGUIDialogSelectGameClient::GetDialog(const std::string &title)
{
CGUIDialogSelect *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (dialog != nullptr)
{
dialog->Reset();
dialog->SetHeading(CVariant{ title });
dialog->SetUseDetails(true);
}
return dialog;
}
示例3: ShowPlaySelection
bool CGUIDialogSimpleMenu::ShowPlaySelection(CFileItem& item, const std::string& directory)
{
CFileItemList items;
if (!XFILE::CDirectory::GetDirectory(directory, items, XFILE::CDirectory::CHints(), true))
{
CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get play directory for %s", directory.c_str());
return true;
}
if (items.IsEmpty())
{
CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", directory.c_str());
return true;
}
CGUIDialogSelect* dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
while (true)
{
dialog->Reset();
dialog->SetHeading(CVariant{25006}); // Select playback item
dialog->SetItems(items);
dialog->SetUseDetails(true);
dialog->Open();
CFileItemPtr item_new = dialog->GetSelectedItem();
if (!item_new || dialog->GetSelectedLabel() < 0)
{
CLog::Log(LOGDEBUG, "CGUIWindowVideoBase::ShowPlaySelection - User aborted %s", directory.c_str());
break;
}
if (item_new->m_bIsFolder == false)
{
std::string original_path = item.GetPath();
item.Reset();
item = *item_new;
item.SetProperty("original_listitem_url", original_path);
return true;
}
items.Clear();
if (!XFILE::CDirectory::GetDirectory(item_new->GetPath(), items, XFILE::CDirectory::CHints(), true) || items.IsEmpty())
{
CLog::Log(LOGERROR, "CGUIWindowVideoBase::ShowPlaySelection - Failed to get any items %s", item_new->GetPath().c_str());
break;
}
}
return false;
}
示例4: OnSettingAction
void CPeripherals::OnSettingAction(const CSetting *setting)
{
if (setting == NULL)
return;
const std::string &settingId = setting->GetId();
if (settingId == CSettings::SETTING_INPUT_PERIPHERALS)
{
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
CFileItemList items;
GetDirectory("peripherals://all/", items);
int iPos = -1;
do
{
pDialog->Reset();
pDialog->SetHeading(CVariant{35000});
pDialog->SetUseDetails(true);
pDialog->SetItems(items);
pDialog->SetSelected(iPos);
pDialog->Open();
iPos = pDialog->IsConfirmed() ? pDialog->GetSelectedLabel() : -1;
if (iPos >= 0)
{
CFileItemPtr pItem = items.Get(iPos);
CGUIDialogPeripheralSettings *pSettingsDialog = (CGUIDialogPeripheralSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_SETTINGS);
if (pItem && pSettingsDialog)
{
// pass peripheral item properties to settings dialog so skin authors
// can use it to show more detailed information about the device
pSettingsDialog->SetProperty("vendor", pItem->GetProperty("vendor"));
pSettingsDialog->SetProperty("product", pItem->GetProperty("product"));
pSettingsDialog->SetProperty("bus", pItem->GetProperty("bus"));
pSettingsDialog->SetProperty("location", pItem->GetProperty("location"));
pSettingsDialog->SetProperty("class", pItem->GetProperty("class"));
pSettingsDialog->SetProperty("version", pItem->GetProperty("version"));
// open settings dialog
pSettingsDialog->SetFileItem(pItem.get());
pSettingsDialog->Open();
}
}
} while (pDialog->IsConfirmed());
}
}
示例5: GetAutoLoginProfileChoice
bool CGUIWindowSettingsProfile::GetAutoLoginProfileChoice(int &iProfile)
{
CGUIDialogSelect *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (!dialog) return false;
const CProfilesManager &profileManager = CServiceBroker::GetProfileManager();
// add items
// "Last used profile" option comes first, so up indices by 1
int autoLoginProfileId = profileManager.GetAutoLoginProfileId() + 1;
CFileItemList items;
CFileItemPtr item(new CFileItem());
item->SetLabel(g_localizeStrings.Get(37014)); // Last used profile
item->SetIconImage("DefaultUser.png");
items.Add(item);
for (unsigned int i = 0; i < profileManager.GetNumberOfProfiles(); i++)
{
const CProfile *profile = profileManager.GetProfile(i);
std::string locked = g_localizeStrings.Get(profile->getLockMode() > 0 ? 20166 : 20165);
CFileItemPtr item(new CFileItem(profile->getName()));
item->SetLabel2(locked); // lock setting
std::string thumb = profile->getThumb();
if (thumb.empty())
thumb = "DefaultUser.png";
item->SetIconImage(thumb);
items.Add(item);
}
dialog->SetHeading(CVariant{20093}); // Profile name
dialog->Reset();
dialog->SetUseDetails(true);
dialog->SetItems(items);
dialog->SetSelected(autoLoginProfileId);
dialog->Open();
if (dialog->IsButtonPressed() || dialog->GetSelectedItem() < 0)
return false; // user cancelled
iProfile = dialog->GetSelectedItem() - 1;
return true;
}
示例6: GetAutoLoginProfileChoice
bool CGUIWindowSettingsProfile::GetAutoLoginProfileChoice(int &iProfile)
{
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!dialog) return false;
// add items
// "Most recent" option comes first, so up indices by 1
int autoLoginProfileId = CProfilesManager::Get().GetAutoLoginProfileId() + 1;
CFileItemList items;
CFileItemPtr item(new CFileItem());
item->SetLabel(g_localizeStrings.Get(37014)); // Most recent
item->SetIconImage("unknown-user.png");
items.Add(item);
for (unsigned int i = 0; i < CProfilesManager::Get().GetNumberOfProfiles(); i++)
{
const CProfile *profile = CProfilesManager::Get().GetProfile(i);
CStdString locked = g_localizeStrings.Get(profile->getLockMode() > 0 ? 20166 : 20165);
CFileItemPtr item(new CFileItem(profile->getName()));
item->SetProperty("Addon.Summary", locked); // lock setting
CStdString thumb = profile->getThumb();
if (thumb.IsEmpty())
thumb = "unknown-user.png";
item->SetIconImage(thumb);
items.Add(item);
}
dialog->SetHeading(20093); // Profile name
dialog->Reset();
dialog->SetUseDetails(true);
dialog->EnableButton(true, 222); // Cancel
dialog->SetItems(&items);
dialog->SetSelected(autoLoginProfileId);
dialog->DoModal();
if (dialog->IsButtonPressed() || dialog->GetSelectedLabel() < 0)
return false; // user cancelled
iProfile = dialog->GetSelectedLabel() - 1;
return true;
}
示例7: ChooseArtType
string CGUIDialogVideoInfo::ChooseArtType(const CFileItem &videoItem, map<string, string> ¤tArt)
{
// prompt for choice
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!dialog || !videoItem.HasVideoInfoTag())
return "";
CFileItemList items;
dialog->SetHeading(13511);
dialog->Reset();
dialog->SetUseDetails(true);
CVideoDatabase db;
db.Open();
vector<string> artTypes = CVideoThumbLoader::GetArtTypes(videoItem.GetVideoInfoTag()->m_type);
// add in any stored art for this item that is non-empty.
db.GetArtForItem(videoItem.GetVideoInfoTag()->m_iDbId, videoItem.GetVideoInfoTag()->m_type, currentArt);
for (CGUIListItem::ArtMap::iterator i = currentArt.begin(); i != currentArt.end(); ++i)
{
if (!i->second.empty() && find(artTypes.begin(), artTypes.end(), i->first) == artTypes.end())
artTypes.push_back(i->first);
}
for (vector<string>::const_iterator i = artTypes.begin(); i != artTypes.end(); ++i)
{
string type = *i;
CFileItemPtr item(new CFileItem(type, "false"));
item->SetLabel(type);
if (videoItem.HasArt(type))
item->SetArt("thumb", videoItem.GetArt(type));
items.Add(item);
}
dialog->SetItems(&items);
dialog->DoModal();
return dialog->GetSelectedItem()->GetLabel();
}
示例8: SelectAddonID
//.........这里部分代码省略.........
}
}
if (addons.empty() && !showNone)
return -1;
// turn the addons into items
std::map<std::string, AddonPtr> addonMap;
CFileItemList items;
for (ADDON::IVECADDONS addon = addons.begin(); addon != addons.end(); ++addon)
{
CFileItemPtr item(CAddonsDirectory::FileItemFromAddon(*addon, (*addon)->ID()));
item->SetLabel2((*addon)->Summary());
if (!items.Contains(item->GetPath()))
{
items.Add(item);
addonMap.insert(std::make_pair(item->GetPath(), *addon));
}
}
if (items.IsEmpty() && !showNone)
return -1;
std::string heading;
for (std::vector<ADDON::TYPE>::const_iterator type = validTypes.begin(); type != validTypes.end(); ++type)
{
if (!heading.empty())
heading += ", ";
heading += TranslateType(*type, true);
}
dialog->SetHeading(CVariant{std::move(heading)});
dialog->Reset();
dialog->SetUseDetails(showDetails);
if (multipleSelection)
{
showNone = false;
showMore = false;
dialog->EnableButton(true, 186);
}
else if (showMore)
dialog->EnableButton(true, 21452);
if (showNone)
{
CFileItemPtr item(new CFileItem("", false));
item->SetLabel(g_localizeStrings.Get(231));
item->SetLabel2(g_localizeStrings.Get(24040));
item->SetIconImage("DefaultAddonNone.png");
item->SetSpecialSort(SortSpecialOnTop);
items.Add(item);
}
items.Sort(SortByLabel, SortOrderAscending);
if (!addonIDs.empty())
{
for (std::vector<std::string>::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; ++it)
{
CFileItemPtr item = items.Get(*it);
if (item)
item->Select(true);
}
}
dialog->SetItems(items);
dialog->SetMultiSelection(multipleSelection);
示例9: SelectAddonID
int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, CStdStringArray &addonIDs, bool showNone /*= false*/, bool multipleSelection /*= true*/)
{
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!dialog)
return 0;
CFileItemList items;
CStdString heading;
int iTypes = 0;
for (vector<ADDON::TYPE>::const_iterator it = types.begin(); it != types.end(); ++it)
{
if (*it == ADDON_UNKNOWN)
continue;
ADDON::VECADDONS addons;
iTypes++;
if (*it == ADDON_AUDIO)
CAddonsDirectory::GetScriptsAndPlugins("audio",addons);
else if (*it == ADDON_EXECUTABLE)
CAddonsDirectory::GetScriptsAndPlugins("executable",addons);
else if (*it == ADDON_IMAGE)
CAddonsDirectory::GetScriptsAndPlugins("image",addons);
else if (*it == ADDON_VIDEO)
CAddonsDirectory::GetScriptsAndPlugins("video",addons);
else
CAddonMgr::Get().GetAddons(*it, addons);
for (ADDON::IVECADDONS it2 = addons.begin() ; it2 != addons.end() ; ++it2)
{
CFileItemPtr item(CAddonsDirectory::FileItemFromAddon(*it2, ""));
if (!items.Contains(item->GetPath()))
items.Add(item);
}
if (!heading.IsEmpty())
heading += ", ";
heading += TranslateType(*it, true);
}
if (iTypes == 0)
return 0;
dialog->SetHeading(heading);
dialog->Reset();
dialog->SetUseDetails(true);
if (multipleSelection)
showNone = false;
if (multipleSelection || iTypes > 1)
dialog->EnableButton(true, 186);
else
dialog->EnableButton(true, 21452);
if (showNone)
{
CFileItemPtr item(new CFileItem("", false));
item->SetLabel(g_localizeStrings.Get(231));
item->SetLabel2(g_localizeStrings.Get(24040));
item->SetIconImage("DefaultAddonNone.png");
item->SetSpecialSort(SortSpecialOnTop);
items.Add(item);
}
items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
if (addonIDs.size() > 0)
{
for (CStdStringArray::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; it++)
{
CFileItemPtr item = items.Get(*it);
if (item)
item->Select(true);
}
}
dialog->SetItems(&items);
dialog->SetMultiSelection(multipleSelection);
dialog->DoModal();
if (!multipleSelection && iTypes == 1 && dialog->IsButtonPressed())
{ // switch to the addons browser.
vector<CStdString> params;
params.push_back("addons://all/"+TranslateType(types[0],false)+"/");
params.push_back("return");
g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params);
return 2;
}
if (!dialog->IsConfirmed())
return 0;
addonIDs.clear();
const CFileItemList& list = dialog->GetSelectedItems();
for (int i = 0 ; i < list.Size() ; i++)
addonIDs.push_back(list.Get(i)->GetPath());
return 1;
}
示例10: OnSettingAction
void CPeripherals::OnSettingAction(const CSetting *setting)
{
if (setting == nullptr)
return;
const std::string &settingId = setting->GetId();
if (settingId == CSettings::SETTING_INPUT_PERIPHERALS)
{
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
CFileItemList items;
GetDirectory("peripherals://all/", items);
int iPos = -1;
do
{
pDialog->Reset();
pDialog->SetHeading(CVariant{35000});
pDialog->SetUseDetails(true);
pDialog->SetItems(items);
pDialog->SetSelected(iPos);
pDialog->Open();
iPos = pDialog->IsConfirmed() ? pDialog->GetSelectedItem() : -1;
if (iPos >= 0)
{
CFileItemPtr pItem = items.Get(iPos);
// show an error if the peripheral doesn't have any settings
PeripheralPtr peripheral = GetByPath(pItem->GetPath());
if (!peripheral || peripheral->GetSettings().empty())
{
CGUIDialogOK::ShowAndGetInput(CVariant{35000}, CVariant{35004});
continue;
}
CGUIDialogPeripheralSettings *pSettingsDialog = (CGUIDialogPeripheralSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_SETTINGS);
if (pItem && pSettingsDialog)
{
// pass peripheral item properties to settings dialog so skin authors
// can use it to show more detailed information about the device
pSettingsDialog->SetProperty("vendor", pItem->GetProperty("vendor"));
pSettingsDialog->SetProperty("product", pItem->GetProperty("product"));
pSettingsDialog->SetProperty("bus", pItem->GetProperty("bus"));
pSettingsDialog->SetProperty("location", pItem->GetProperty("location"));
pSettingsDialog->SetProperty("class", pItem->GetProperty("class"));
pSettingsDialog->SetProperty("version", pItem->GetProperty("version"));
// open settings dialog
pSettingsDialog->SetFileItem(pItem.get());
pSettingsDialog->Open();
}
}
} while (pDialog->IsConfirmed());
}
else if (settingId == CSettings::SETTING_INPUT_CONTROLLERCONFIG)
g_windowManager.ActivateWindow(WINDOW_DIALOG_GAME_CONTROLLERS);
else if (settingId == CSettings::SETTING_INPUT_TESTRUMBLE)
TestFeature(FEATURE_RUMBLE);
}
示例11: SelectAddonID
int CGUIWindowAddonBrowser::SelectAddonID(ADDON::TYPE type, CStdStringArray &addonIDs, bool showNone /*= false*/, bool multipleSelection /*= true*/)
{
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (type == ADDON_UNKNOWN || !dialog)
return 0;
ADDON::VECADDONS addons;
if (type == ADDON_AUDIO)
CAddonsDirectory::GetScriptsAndPlugins("audio",addons);
else if (type == ADDON_EXECUTABLE)
CAddonsDirectory::GetScriptsAndPlugins("executable",addons);
else if (type == ADDON_IMAGE)
CAddonsDirectory::GetScriptsAndPlugins("image",addons);
else if (type == ADDON_VIDEO)
CAddonsDirectory::GetScriptsAndPlugins("video",addons);
else
CAddonMgr::Get().GetAddons(type, addons);
CFileItemList items;
for (ADDON::IVECADDONS i = addons.begin(); i != addons.end(); ++i)
items.Add(CAddonsDirectory::FileItemFromAddon(*i, ""));
dialog->SetHeading(TranslateType(type, true));
dialog->Reset();
dialog->SetUseDetails(true);
if (multipleSelection)
{
showNone = false;
dialog->EnableButton(true, 186);
}
else
dialog->EnableButton(true, 21452);
if (showNone)
{
CFileItemPtr item(new CFileItem("", false));
item->SetLabel(g_localizeStrings.Get(231));
item->SetLabel2(g_localizeStrings.Get(24040));
item->SetIconImage("DefaultAddonNone.png");
item->SetSpecialSort(SORT_ON_TOP);
items.Add(item);
}
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
if (addonIDs.size() > 0)
{
for (CStdStringArray::const_iterator it = addonIDs.begin(); it != addonIDs.end() ; it++)
{
CFileItemPtr item = items.Get(*it);
if (item)
item->Select(true);
}
}
dialog->SetItems(&items);
dialog->SetMultiSelection(multipleSelection);
dialog->DoModal();
if (!multipleSelection && dialog->IsButtonPressed())
{ // switch to the addons browser.
vector<CStdString> params;
params.push_back("addons://all/"+TranslateType(type,false)+"/");
params.push_back("return");
g_windowManager.ActivateWindow(WINDOW_ADDON_BROWSER, params);
return 2;
}
if (!multipleSelection && dialog->GetSelectedLabel() == -1)
return 0;
addonIDs.clear();
const CFileItemList& list = dialog->GetSelectedItems();
for (int i = 0 ; i < list.Size() ; i++)
addonIDs.push_back(list.Get(i)->GetPath());
return 1;
}