本文整理汇总了C++中PVR_CLIENT::CallMenuHook方法的典型用法代码示例。如果您正苦于以下问题:C++ PVR_CLIENT::CallMenuHook方法的具体用法?C++ PVR_CLIENT::CallMenuHook怎么用?C++ PVR_CLIENT::CallMenuHook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVR_CLIENT
的用法示例。
在下文中一共展示了PVR_CLIENT::CallMenuHook方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessMenuHooks
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat)
{
PVR_MENUHOOKS *hooks = NULL;
// get client id
if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING)
{
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
if (clients.size() == 1)
{
iClientID = clients.begin()->first;
}
else if (clients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
PVR_CLIENTMAP_ITR itrClients;
for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
pDialog->Add(itrClients->second->GetBackendName());
}
pDialog->DoModal();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
{
itrClients = clients.begin();
for (int i = 0; i < selection; i++)
itrClients++;
iClientID = itrClients->first;
}
}
}
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat))
{
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));
}
}
示例2: ProcessMenuHooks
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat, const CFileItem *item)
{
// get client id
if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING)
{
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
if (clients.size() == 1)
{
iClientID = clients.begin()->first;
}
else if (clients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19196});
PVR_CLIENTMAP_CITR itrClients;
for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
pDialog->Add(itrClients->second->GetBackendName());
}
pDialog->Open();
int selection = pDialog->GetSelectedItem();
if (selection >= 0)
{
itrClients = clients.begin();
for (int i = 0; i < selection; i++)
itrClients++;
iClientID = itrClients->first;
}
}
}
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat))
{
PVR_MENUHOOKS *hooks = client->GetMenuHooks();
std::vector<int> hookIDs;
int selection = 0;
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19196});
for (unsigned int i = 0; i < hooks->size(); i++)
if (hooks->at(i).category == cat || hooks->at(i).category == PVR_MENUHOOK_ALL)
{
pDialog->Add(g_localizeStrings.GetAddonString(client->ID(), hooks->at(i).iLocalizedStringId));
hookIDs.push_back(i);
}
if (hookIDs.size() > 1)
{
pDialog->Open();
selection = pDialog->GetSelectedItem();
}
if (selection >= 0)
client->CallMenuHook(hooks->at(hookIDs.at(selection)), item);
}
}