void CPVRClients::ProcessMenuHooks(int iClientID) { PVR_MENUHOOKS *hooks = NULL; CSingleLock lock(m_critSection); if (iClientID < 0) iClientID = GetPlayingClientID(); if (GetMenuHooks(iClientID, hooks)) { boost::shared_ptr<CPVRClient> client = m_clientMap.find(iClientID)->second; lock.Leave(); std::vector<long> 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).string_id)); 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); } }
void CPVRClients::ProcessMenuHooks(int iClientID) { PVR_MENUHOOKS *hooks = NULL; if (iClientID < 0) iClientID = GetPlayingClientID(); boost::shared_ptr<CPVRClient> 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)); } }
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)); } }
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); } }
void CAddonHelpers_PVR::PVRAddMenuHook(void *addonData, PVR_MENUHOOK *hook) { CAddonHelpers* addon = (CAddonHelpers*) addonData; if (addon == NULL || hook == NULL) { CLog::Log(LOGERROR, "PVR: PVRAddMenuHook is called with NULL-Pointer!!!"); return; } CAddonHelpers_PVR* addonHelper = addon->GetHelperPVR(); CPVRClient* client = (CPVRClient*) addonHelper->m_addon; PVR_MENUHOOKS *hooks = client->GetMenuHooks(); PVR_MENUHOOK hookInt; hookInt.hook_id = hook->hook_id; hookInt.string_id = hook->string_id; hooks->push_back(hookInt); }
void CAddonCallbacksPVR::PVRAddMenuHook(void *addonData, PVR_MENUHOOK *hook) { CAddonCallbacks* addon = (CAddonCallbacks*) addonData; if (addon == NULL || hook == NULL) { CLog::Log(LOGERROR, "CAddonCallbacksPVR - %s - called with a null pointer", __FUNCTION__); return; } CAddonCallbacksPVR* addonHelper = addon->GetHelperPVR(); CPVRClient* client = (CPVRClient*) addonHelper->m_addon; PVR_MENUHOOKS *hooks = client->GetMenuHooks(); PVR_MENUHOOK hookInt; hookInt.iHookId = hook->iHookId; hookInt.iLocalizedStringId = hook->iLocalizedStringId; /* add this new hook */ hooks->push_back(hookInt); }
void CAddonCallbacksPVR::PVRAddMenuHook(void *addonData, PVR_MENUHOOK *hook) { CPVRClient *client = GetPVRClient(addonData); if (!hook || !client) { CLog::Log(LOGERROR, "PVR - %s - invalid handler data", __FUNCTION__); return; } PVR_MENUHOOKS *hooks = client->GetMenuHooks(); if (hooks) { PVR_MENUHOOK hookInt; hookInt.iHookId = hook->iHookId; hookInt.iLocalizedStringId = hook->iLocalizedStringId; /* add this new hook */ hooks->push_back(hookInt); } }
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); } }