本文整理汇总了C++中CGUIDialogSelect::SetHeading方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogSelect::SetHeading方法的具体用法?C++ CGUIDialogSelect::SetHeading怎么用?C++ CGUIDialogSelect::SetHeading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogSelect
的用法示例。
在下文中一共展示了CGUIDialogSelect::SetHeading方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenChannelGroupSelectionDialog
bool CGUIWindowPVRBase::OpenChannelGroupSelectionDialog(void)
{
CGUIDialogSelect *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (!dialog)
return false;
CFileItemList options;
CServiceBroker::GetPVRManager().ChannelGroups()->Get(m_bRadio)->GetGroupList(&options, true);
dialog->Reset();
dialog->SetHeading(CVariant{g_localizeStrings.Get(19146)});
dialog->SetItems(options);
dialog->SetMultiSelection(false);
dialog->SetSelected(m_channelGroup->GroupName());
dialog->Open();
if (!dialog->IsConfirmed())
return false;
const CFileItemPtr item = dialog->GetSelectedFileItem();
if (!item)
return false;
SetChannelGroup(CServiceBroker::GetPVRManager().ChannelGroups()->Get(m_bRadio)->GetByName(item->m_strTitle));
return true;
}
示例2: open
int Interface_GUIDialogSelect::open(void* kodiBase, const char *heading, const char *entries[], unsigned int size, int selected, bool autoclose)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "Interface_GUIDialogSelect::%s - invalid data", __FUNCTION__);
return -1;
}
CGUIDialogSelect* dialog = g_windowManager.GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (!heading || !entries || !dialog)
{
CLog::Log(LOGERROR, "Interface_GUIDialogSelect::%s - invalid handler data (heading='%p', entries='%p', dialog='%p') on addon '%s'", __FUNCTION__,
heading, entries, dialog, addon->ID().c_str());
return -1;
}
dialog->Reset();
dialog->SetHeading(CVariant{heading});
for (unsigned int i = 0; i < size; ++i)
dialog->Add(entries[i]);
if (selected > 0)
dialog->SetSelected(selected);
if (autoclose > 0)
dialog->SetAutoClose(autoclose);
dialog->Open();
return dialog->GetSelectedItem();
}
示例3: OnField
void CGUIDialogSmartPlaylistRule::OnField()
{
const auto fields = CSmartPlaylistRule::GetFields(m_type);
CGUIDialogSelect* dialog = g_windowManager.GetWindow<CGUIDialogSelect>();
dialog->Reset();
dialog->SetHeading(CVariant{20427});
int selected = -1;
for (auto field = fields.begin(); field != fields.end(); field++)
{
dialog->Add(CSmartPlaylistRule::GetLocalizedField(*field));
if (*field == m_rule.m_field)
selected = std::distance(fields.begin(), field);
}
if (selected > -1)
dialog->SetSelected(selected);
dialog->Open();
int newSelected = dialog->GetSelectedItem();
// check if selection has changed
if (!dialog->IsConfirmed() || newSelected < 0 || newSelected == selected)
return;
m_rule.m_field = fields[newSelected];
// check if operator is still valid. if not, reset to first valid one
std::vector< std::pair<std::string, int> > validOperators = GetValidOperators(m_rule);
bool isValid = false;
for (auto op : validOperators)
if (std::get<0>(op) == std::get<0>(OperatorLabel(m_rule.m_operator)))
isValid = true;
if (!isValid)
m_rule.m_operator = (CDatabaseQueryRule::SEARCH_OPERATOR)std::get<1>(validOperators[0]);
m_rule.SetParameter("");
UpdateButtons();
}
示例4: ProcessMenuHooks
void CPVRClients::ProcessMenuHooks(int iClientID)
{
PVR_MENUHOOKS *hooks = NULL;
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks())
{
hooks = client->GetMenuHooks();
std::vector<int> hookIDs;
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
for (unsigned int i = 0; i < hooks->size(); i++)
pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId));
pDialog->DoModal();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
client->CallMenuHook(hooks->at(selection));
}
}
示例5: ProcessMenuHooks
void CPVRClients::ProcessMenuHooks(int iClientID)
{
PVR_MENUHOOKS *hooks = NULL;
if (iClientID < 0)
iClientID = GetPlayingClientID();
if (GetMenuHooks(iClientID, hooks))
{
boost::shared_ptr<CPVRClient> client;
if (!GetValidClient(iClientID, client))
return;
std::vector<int> hookIDs;
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
for (unsigned int i = 0; i < hooks->size(); i++)
pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId));
pDialog->DoModal();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
{
client->CallMenuHook(hooks->at(selection));
}
}
else
{
CLog::Log(LOGERROR, "PVR - %s - cannot find client %d",__FUNCTION__, iClientID);
}
}
示例6: dcguard
std::vector<int>* Dialog::multiselect(const String& heading,
const std::vector<String>& options, int autoclose)
{
DelayedCallGuard dcguard(languageHook);
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (pDialog == nullptr)
throw WindowException("Error: Window is NULL");
pDialog->Reset();
pDialog->SetMultiSelection(true);
pDialog->SetHeading(CVariant{heading});
for (const auto& option : options)
pDialog->Add(option);
if (autoclose > 0)
pDialog->SetAutoClose(autoclose);
pDialog->Open();
if (pDialog->IsConfirmed())
return new std::vector<int>(pDialog->GetSelectedItems());
else
return nullptr;
}
示例7: OpenGroupSelectionDialog
bool CGUIWindowPVRBase::OpenGroupSelectionDialog(void)
{
CGUIDialogSelect *dialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!dialog)
return false;
CFileItemList options;
g_PVRChannelGroups->Get(m_bRadio)->GetGroupList(&options);
dialog->Reset();
dialog->SetHeading(g_localizeStrings.Get(19146));
dialog->SetItems(&options);
dialog->SetMultiSelection(false);
dialog->SetSelected(m_group->GroupName());
dialog->DoModal();
if (!dialog->IsConfirmed())
return false;
const CFileItemPtr item = dialog->GetSelectedItem();
if (!item)
return false;
SetGroup(g_PVRChannelGroups->Get(m_bRadio)->GetByName(item->m_strTitle));
return true;
}
示例8: 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;
}
示例9: GetStereoModeByUserChoice
RENDER_STEREO_MODE CStereoscopicsManager::GetStereoModeByUserChoice(const std::string &heading)
{
RENDER_STEREO_MODE mode = GetStereoMode();
// if no stereo mode is set already, suggest mode of current video by preselecting it
if (mode == RENDER_STEREO_MODE_OFF && g_infoManager.EvaluateBool("videoplayer.isstereoscopic"))
mode = GetStereoModeOfPlayingVideo();
CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDlgSelect->Reset();
if (heading.empty())
pDlgSelect->SetHeading(CVariant{g_localizeStrings.Get(36528)});
else
pDlgSelect->SetHeading(CVariant{heading});
// prepare selectable stereo modes
std::vector<RENDER_STEREO_MODE> selectableModes;
for (int i = RENDER_STEREO_MODE_OFF; i < RENDER_STEREO_MODE_COUNT; i++)
{
RENDER_STEREO_MODE selectableMode = (RENDER_STEREO_MODE) i;
if (g_Windowing.SupportsStereo(selectableMode))
{
selectableModes.push_back(selectableMode);
std::string label = GetLabelForStereoMode((RENDER_STEREO_MODE) i);
pDlgSelect->Add( label );
if (mode == selectableMode)
pDlgSelect->SetSelected( label );
}
// inject AUTO pseudo mode after OFF
if (i == RENDER_STEREO_MODE_OFF)
{
selectableModes.push_back(RENDER_STEREO_MODE_AUTO);
pDlgSelect->Add(GetLabelForStereoMode(RENDER_STEREO_MODE_AUTO));
}
}
pDlgSelect->Open();
int iItem = pDlgSelect->GetSelectedLabel();
if (iItem > -1 && pDlgSelect->IsConfirmed())
mode = (RENDER_STEREO_MODE) selectableModes[iItem];
else
mode = GetStereoMode();
return mode;
}
示例10: DeleteAllRecordingsFromTrash
PVR_ERROR CPVRClients::DeleteAllRecordingsFromTrash()
{
PVR_ERROR error(PVR_ERROR_NO_ERROR);
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
std::vector<PVR_CLIENT> suppClients;
for (PVR_CLIENTMAP_CITR itrClients = clients.begin(); itrClients != clients.end(); ++itrClients)
{
if (itrClients->second->SupportsRecordingsUndelete() && itrClients->second->GetRecordingsAmount(true) > 0)
suppClients.push_back(itrClients->second);
}
int selection = 0;
if (suppClients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19292}); //Delete all permanently
pDialog->Add(g_localizeStrings.Get(24032)); // All Add-ons
PVR_CLIENTMAP_CITR itrClients;
for (itrClients = clients.begin(); itrClients != clients.end(); ++itrClients)
{
if (itrClients->second->SupportsRecordingsUndelete() && itrClients->second->GetRecordingsAmount(true) > 0)
pDialog->Add(itrClients->second->GetBackendName());
}
pDialog->Open();
selection = pDialog->GetSelectedItem();
}
if (selection == 0)
{
typedef std::vector<PVR_CLIENT>::const_iterator suppClientsCITR;
for (suppClientsCITR itrSuppClients = suppClients.begin(); itrSuppClients != suppClients.end(); ++itrSuppClients)
{
PVR_ERROR currentError = (*itrSuppClients)->DeleteAllRecordingsFromTrash();
if (currentError != PVR_ERROR_NO_ERROR)
{
CLog::Log(LOGERROR, "PVR - %s - cannot delete all recordings from client '%d': %s",__FUNCTION__, (*itrSuppClients)->GetID(), CPVRClient::ToString(currentError));
error = currentError;
}
}
}
else if (selection >= 1 && selection <= (int)suppClients.size())
{
PVR_ERROR currentError = suppClients[selection-1]->DeleteAllRecordingsFromTrash();
if (currentError != PVR_ERROR_NO_ERROR)
{
CLog::Log(LOGERROR, "PVR - %s - cannot delete all recordings from client '%d': %s",__FUNCTION__, suppClients[selection-1]->GetID(), CPVRClient::ToString(currentError));
error = currentError;
}
}
return error;
}
示例11: OnLinkMovieToTvShow
void CGUIWindowVideoNav::OnLinkMovieToTvShow(int itemnumber, bool bRemove)
{
CFileItemList list;
if (bRemove)
{
vector<int> ids;
if (!m_database.GetLinksToTvShow(m_vecItems->Get(itemnumber)->GetVideoInfoTag()->m_iDbId,ids))
return;
for (unsigned int i=0;i<ids.size();++i)
{
CVideoInfoTag tag;
m_database.GetTvShowInfo("",tag,ids[i]);
CFileItemPtr show(new CFileItem(tag));
list.Add(show);
}
}
else
{
m_database.GetTvShowsNav("videodb://2/2",list);
// remove already linked shows
vector<int> ids;
if (!m_database.GetLinksToTvShow(m_vecItems->Get(itemnumber)->GetVideoInfoTag()->m_iDbId,ids))
return;
for (int i=0;i<list.Size();)
{
unsigned int j;
for (j=0;j<ids.size();++j)
{
if (list[i]->GetVideoInfoTag()->m_iDbId == ids[j])
break;
}
if (j == ids.size())
i++;
else
list.Remove(i);
}
}
int iSelectedLabel = 0;
if (list.Size() > 1)
{
list.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SORT_ORDER_ASC);
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetItems(&list);
pDialog->SetHeading(20356);
pDialog->DoModal();
iSelectedLabel = pDialog->GetSelectedLabel();
}
if (iSelectedLabel > -1)
{
m_database.LinkMovieToTvshow(m_vecItems->Get(itemnumber)->GetVideoInfoTag()->m_iDbId,
list[iSelectedLabel]->GetVideoInfoTag()->m_iDbId, bRemove);
CUtil::DeleteVideoDatabaseDirectoryCache();
}
}
示例12: open_multi_select
bool Interface_GUIDialogSelect::open_multi_select(void* kodiBase, const char *heading, const char *entryIDs[], const char *entryNames[],
bool entriesSelected[], unsigned int size, unsigned int autoclose)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "Interface_GUIDialogMultiSelect::%s - invalid data", __FUNCTION__);
return false;
}
CGUIDialogSelect* dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (!heading || !entryIDs || !entryNames || !entriesSelected || !dialog)
{
CLog::Log(LOGERROR,
"Interface_GUIDialogMultiSelect::%s - invalid handler data (heading='%p', "
"entryIDs='%p', entryNames='%p', entriesSelected='%p', dialog='%p') on addon '%s'",
__FUNCTION__, heading, static_cast<const void*>(entryIDs),
static_cast<const void*>(entryNames), static_cast<void*>(entriesSelected),
static_cast<void*>(dialog), addon->ID().c_str());
return false;
}
dialog->Reset();
dialog->SetMultiSelection(true);
dialog->SetHeading(CVariant{heading});
std::vector<int> selectedIndexes;
for (unsigned int i = 0; i < size; ++i)
{
dialog->Add(entryNames[i]);
if (entriesSelected[i])
selectedIndexes.push_back(i);
}
dialog->SetSelected(selectedIndexes);
if (autoclose > 0)
dialog->SetAutoClose(autoclose);
dialog->Open();
if (dialog->IsConfirmed())
{
for (unsigned int i = 0; i < size; ++i)
entriesSelected[i] = false;
selectedIndexes = dialog->GetSelectedItems();
for (unsigned int i = 0; i < selectedIndexes.size(); ++i)
{
if (selectedIndexes[i])
entriesSelected[selectedIndexes[i]] = true;
}
}
return true;
}
示例13:
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;
}
示例14: OnAction
bool CGUIDialogMusicOSD::OnAction(const CAction &action)
{
switch (action.GetID())
{
case ACTION_SHOW_OSD:
Close();
return true;
case ACTION_SET_RATING:
{
CGUIDialogSelect *dialog = g_windowManager.GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (dialog)
{
dialog->SetHeading(CVariant{ 38023 });
dialog->Add(g_localizeStrings.Get(38022));
for (int i = 1; i <= 10; i++)
dialog->Add(StringUtils::Format("%s: %i", g_localizeStrings.Get(563).c_str(), i));
auto track = g_application.CurrentFileItemPtr();
dialog->SetSelected(track->GetMusicInfoTag()->GetUserrating());
dialog->Open();
int userrating = dialog->GetSelectedItem();
if (userrating < 0) userrating = 0;
if (userrating > 10) userrating = 10;
if (userrating != track->GetMusicInfoTag()->GetUserrating())
{
track->GetMusicInfoTag()->SetUserrating(userrating);
// send a message to all windows to tell them to update the fileitem (eg playlistplayer, media windows)
CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_ITEM, 0, track);
g_windowManager.SendMessage(msg);
CMusicDatabase db;
if (db.Open())
{
db.SetSongUserrating(track->GetMusicInfoTag()->GetURL(), userrating);
db.Close();
}
}
}
return true;
}
default:
break;
}
return CGUIDialog::OnAction(action);
}
示例15: 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;
}