// \brief Show CGUIDialogOK dialog, then wait for user to dismiss it. void CGUIDialogOK::ShowAndGetInput(const CVariant &heading, const CVariant &line0, const CVariant &line1, const CVariant &line2) { CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (!dialog) return; dialog->SetHeading(heading); dialog->SetLine(0, line0); dialog->SetLine(1, line1); dialog->SetLine(2, line2); dialog->DoModal(); }
void CGUIWindowMusicBase::OnRipCD() { if(g_mediaManager.IsAudio()) { if (!g_application.CurrentFileItem().IsCDDA()) { #ifdef HAS_CDDA_RIPPER CCDDARipper ripper; ripper.RipCD(); #endif } else { CGUIDialogOK* pDlgOK = (CGUIDialogOK*)g_windowManager.GetWindow(WINDOW_DIALOG_OK); pDlgOK->SetHeading(257); // Error pDlgOK->SetLine(0, g_localizeStrings.Get(20099)); // pDlgOK->SetLine(1, ""); // pDlgOK->SetLine(2, ""); pDlgOK->DoModal(); } } }
void CGUIWindowMusicBase::OnRipTrack(int iItem) { CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo(); if (CDetectDVDMedia::IsDiscInDrive() && pCdInfo && pCdInfo->IsAudio(1)) { if (!g_application.CurrentFileItem().IsCDDA()) { #ifdef HAS_CDDA_RIPPER CCDDARipper ripper; ripper.RipTrack(m_vecItems->Get(iItem)); #endif } else { CGUIDialogOK* pDlgOK = (CGUIDialogOK*)m_gWindowManager.GetWindow(WINDOW_DIALOG_OK); pDlgOK->SetHeading(257); // Error pDlgOK->SetLine(0, g_localizeStrings.Get(20099)); // pDlgOK->SetLine(1, ""); // pDlgOK->SetLine(2, ""); pDlgOK->DoModal(); } } }
bool IDirectory::ProcessRequirements() { CStdString type = m_requirements["type"].asString(); if (type == "keyboard") { CStdString input; if (CGUIDialogKeyboard::ShowAndGetInput(input, GetLocalized(m_requirements["heading"]), false)) { m_requirements["input"] = input.c_str(); return true; } } else if (type == "authenticate") { CURL url(m_requirements["url"].asString()); if (CPasswordManager::GetInstance().PromptToAuthenticateURL(url)) { m_requirements.clear(); return true; } } else if (type == "error") { CGUIDialogOK *dialog = (CGUIDialogOK *)g_windowManager.GetWindow(WINDOW_DIALOG_OK); if (dialog) { dialog->SetHeading(GetLocalized(m_requirements["heading"])); dialog->SetLine(0, GetLocalized(m_requirements["line1"])); dialog->SetLine(1, GetLocalized(m_requirements["line2"])); dialog->SetLine(2, GetLocalized(m_requirements["line3"])); dialog->DoModal(); } } m_requirements.clear(); return false; }
bool CGUIWindowBoxeeWizardNetwork::OnAction(const CAction &action) { int iControl = GetFocusedControlID(); if (action.wID == ACTION_PREVIOUS_MENU || (action.wID == ACTION_SELECT_ITEM && iControl == CONTROL_BACK)) { Close(); } else if (action.wID == ACTION_SELECT_ITEM && iControl == CONTROL_INTERFACES) { ShowWirelessNetworksIfNeeded(); CGUIListContainer *pList = (CGUIListContainer *)GetControl(CONTROL_INTERFACES); if (pList) pList->SetSingleSelectedItem(); return true; } else if (action.wID == ACTION_MOVE_LEFT && iControl == CONTROL_WIRELESS) { ShowInterfaces(); SET_CONTROL_FOCUS(CONTROL_INTERFACES, 0); CGUIListContainer *pList = (CGUIListContainer *)GetControl(CONTROL_WIRELESS); if (pList) pList->SetSingleSelectedItem(); return true; } else if (action.wID == ACTION_SELECT_ITEM && iControl == CONTROL_WIRELESS) { ShowPasswordIfNeeded(); CGUIListContainer *pList = (CGUIListContainer *)GetControl(CONTROL_WIRELESS); if (pList) pList->SetSingleSelectedItem(); return true; } else if (action.wID == ACTION_SELECT_ITEM && iControl == CONTROL_PASSWORD) { CGUIButtonControl* passwordButton = (CGUIButtonControl*) GetControl(iControl); CStdString password = passwordButton->GetLabel(); if (CGUIDialogKeyboard::ShowAndGetInput(password, g_localizeStrings.Get(789), false)) { passwordButton->SetLabel(password); CONTROL_ENABLE(CONTROL_NEXT); SET_CONTROL_FOCUS(CONTROL_NEXT, 0); } return true; } else if (action.wID == ACTION_SELECT_ITEM && iControl == CONTROL_ENC) { CGUIButtonControl* encSelectionButton = (CGUIButtonControl*) GetControl(CONTROL_ENC_SELECTION); CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_ENC); OnMessage(msg); int iItem = msg.GetParam1(); encSelectionButton->SetLabel(ENC_LABELS[iItem]); SET_CONTROL_HIDDEN(CONTROL_ENC); if (iItem == ENC_NONE) { SET_CONTROL_HIDDEN(CONTROL_PASSWORD_GROUP); SET_CONTROL_FOCUS(CONTROL_NEXT, 0); } else { SET_CONTROL_FOCUS(CONTROL_PASSWORD, 0); } return true; } else if (action.wID == ACTION_MOVE_LEFT && (iControl == CONTROL_ENC_SELECTION || iControl == CONTROL_PASSWORD)) { SET_CONTROL_HIDDEN(CONTROL_ENC_GROUP); SET_CONTROL_HIDDEN(CONTROL_PASSWORD_GROUP); SET_CONTROL_FOCUS(CONTROL_WIRELESS, 0); return true; } else if (action.wID == ACTION_MOVE_DOWN && iControl == CONTROL_ENC_SELECTION) { if (GetControl(CONTROL_PASSWORD_GROUP)->IsVisible()) { SET_CONTROL_FOCUS(CONTROL_PASSWORD, 0); } else if (!GetControl(CONTROL_NEXT)->IsDisabled()) { SET_CONTROL_FOCUS(CONTROL_NEXT, 0); } return true; } else if (action.wID == ACTION_MOVE_UP && (iControl == CONTROL_NEXT || iControl == CONTROL_BACK)) { if (GetControl(CONTROL_PASSWORD_GROUP)->IsVisible()) { SET_CONTROL_FOCUS(CONTROL_PASSWORD, 0); } else if (GetControl(CONTROL_ENC_GROUP)->IsVisible()) { SET_CONTROL_FOCUS(CONTROL_ENC_SELECTION, 0); } else { SET_CONTROL_FOCUS(CONTROL_INTERFACES, 0); } return true; } else if (action.wID == ACTION_SELECT_ITEM && iControl == CONTROL_NEXT) { if (GetControl(CONTROL_ENC_SELECTION)->IsVisible() && GetControl(CONTROL_PASSWORD)->IsVisible()) { CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_ENC); OnMessage(msg); int iItem = msg.GetParam1(); CGUIButtonControl* passwordButton = (CGUIButtonControl*) GetControl(CONTROL_PASSWORD); CStdString password = passwordButton->GetLabel(); if (ENC_MODES[iItem] == ENC_WEP_HEX && !IsHexString(password)) { CGUIDialogOK *pDialogOK = (CGUIDialogOK *)m_gWindowManager.GetWindow(WINDOW_DIALOG_OK); pDialogOK->SetHeading(""); pDialogOK->SetLine(0, 51018); pDialogOK->SetLine(1, 51019); pDialogOK->DoModal(); return true; } } if (SaveConfiguration()) { // Close all wizard dialogs Close(); CGUIDialog* dialog = (CGUIDialog*) m_gWindowManager.GetWindow(WINDOW_BOXEE_WIZARD_AUDIO); dialog->Close(); dialog = (CGUIDialog*) m_gWindowManager.GetWindow(WINDOW_BOXEE_WIZARD_RESOLUTION); dialog->Close(); } return true; } return CGUIWindow::OnAction(action); }