本文整理汇总了C++中CGUIDialogSelect::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogSelect::Add方法的具体用法?C++ CGUIDialogSelect::Add怎么用?C++ CGUIDialogSelect::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogSelect
的用法示例。
在下文中一共展示了CGUIDialogSelect::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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);
}
示例4: 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;
}
示例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: 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();
}
示例7: OnClickButtonNewChannel
bool CGUIDialogPVRChannelManager::OnClickButtonNewChannel()
{
int iSelection = 0;
if (g_PVRClients->ConnectedClientAmount() > 1)
{
CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (!pDlgSelect)
return false;
pDlgSelect->SetHeading(19213); // Select Client
PVR_CLIENT_ITR itr;
for (itr = m_clientsWithSettingsList.begin() ; itr != m_clientsWithSettingsList.end(); ++itr)
pDlgSelect->Add((*itr)->Name());
pDlgSelect->DoModal();
iSelection = pDlgSelect->GetSelectedLabel();
}
if (iSelection >= 0 && iSelection < (int)m_clientsWithSettingsList.size())
{
int iClientID = m_clientsWithSettingsList[iSelection]->GetID();
CPVRChannelPtr channel(new CPVRChannel(m_bIsRadio));
channel->SetChannelName(g_localizeStrings.Get(19204)); // New channel
channel->SetEPGEnabled(g_PVRClients->SupportsEPG(iClientID));
channel->SetClientID(iClientID);
if (g_PVRClients->OpenDialogChannelAdd(channel))
Update();
else
CGUIDialogOK::ShowAndGetInput(2103, 0, 16029, 0); // Add-on error;Check the log file for details.
}
return true;
}
示例8: open
int Interface_GUIDialogSelect::open(void* kodiBase, const char *heading, const char *entries[], unsigned int size, int selected, unsigned int autoclose)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "Interface_GUIDialogSelect::%s - invalid data", __FUNCTION__);
return -1;
}
CGUIDialogSelect* dialog = CServiceBroker::GetGUI()->GetWindowManager().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, static_cast<const void*>(entries), static_cast<void*>(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();
}
示例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: 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;
}
示例11: OnSetUserrating
void CGUIDialogSongInfo::OnSetUserrating()
{
CGUIDialogSelect *dialog = (CGUIDialogSelect *)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (dialog)
{
dialog->SetHeading(CVariant{ 38023 });
dialog->Add(g_localizeStrings.Get(38022));
for (int i = 1; i <= 5; i++)
dialog->Add(StringUtils::Format("%s: %i", g_localizeStrings.Get(563).c_str(), i));
dialog->Open();
int iItem = dialog->GetSelectedLabel();
if (iItem < 0)
return;
SetUserrating('0' + iItem); // This is casting the int rating to char
}
}
示例12: OnSetUserrating
void CGUIDialogMusicInfo::OnSetUserrating()
{
CGUIDialogSelect *dialog = (CGUIDialogSelect *)g_windowManager.GetWindow(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));
dialog->SetSelected(m_albumItem->GetMusicInfoTag()->GetUserrating());
dialog->Open();
int iItem = dialog->GetSelectedItem();
if (iItem < 0)
return;
SetUserrating(iItem);
}
}
示例13: OnSearch
/// \brief Search the current directory for a string got from the virtual keyboard
void CGUIWindowVideoInfo::OnSearch(CStdString& strSearch)
{
if (m_dlgProgress)
{
m_dlgProgress->SetHeading(194);
m_dlgProgress->SetLine(0, strSearch);
m_dlgProgress->SetLine(1, "");
m_dlgProgress->SetLine(2, "");
m_dlgProgress->StartModal();
m_dlgProgress->Progress();
}
CFileItemList items;
DoSearch(strSearch, items);
if (items.Size())
{
CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)m_gWindowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDlgSelect->Reset();
pDlgSelect->SetHeading(283);
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
for (int i = 0; i < (int)items.Size(); i++)
{
CFileItem* pItem = items[i];
pDlgSelect->Add(pItem->GetLabel());
}
pDlgSelect->DoModal();
int iItem = pDlgSelect->GetSelectedLabel();
if (iItem < 0)
{
if (m_dlgProgress) m_dlgProgress->Close();
return ;
}
CFileItem* pSelItem = new CFileItem(*items[iItem]);
OnSearchItemFound(pSelItem);
delete pSelItem;
if (m_dlgProgress) m_dlgProgress->Close();
}
else
{
if (m_dlgProgress) m_dlgProgress->Close();
CGUIDialogOK::ShowAndGetInput(194, 284, 0, 0);
}
}
示例14: OnSetUserrating
void CGUIDialogMusicInfo::OnSetUserrating() const
{
CGUIDialogSelect *dialog = g_windowManager.GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (dialog)
{
// If we refresh and then try to set the rating there will be an items already here...
dialog->Reset();
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));
dialog->SetSelected(m_albumItem->GetMusicInfoTag()->GetUserrating());
dialog->Open();
int iItem = dialog->GetSelectedItem();
if (iItem < 0)
return;
SetUserrating(iItem);
}
}
示例15: OnSearch
/// \brief Search the current directory for a string got from the virtual keyboard
void CGUIDialogVideoInfo::OnSearch(CStdString& strSearch)
{
CGUIDialogProgress *progress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
if (progress)
{
progress->SetHeading(194);
progress->SetLine(0, strSearch);
progress->SetLine(1, "");
progress->SetLine(2, "");
progress->StartModal();
progress->Progress();
}
CFileItemList items;
DoSearch(strSearch, items);
if (progress)
progress->Close();
if (items.Size())
{
CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDlgSelect->Reset();
pDlgSelect->SetHeading(283);
for (int i = 0; i < (int)items.Size(); i++)
{
CFileItemPtr pItem = items[i];
pDlgSelect->Add(pItem->GetLabel());
}
pDlgSelect->DoModal();
int iItem = pDlgSelect->GetSelectedLabel();
if (iItem < 0)
return;
CFileItem* pSelItem = new CFileItem(*items[iItem]);
OnSearchItemFound(pSelItem);
delete pSelItem;
}
else
{
CGUIDialogOK::ShowAndGetInput(194, 284, 0, 0);
}
}