Example #1
0
int CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant text, CVariant noLabel, CVariant yesLabel, CVariant customLabel, unsigned int autoCloseTime)
{
  CGUIDialogYesNo *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);
  if (!dialog)
    return false;

  dialog->SetHeading(heading);
  dialog->SetText(text);
  if (autoCloseTime)
    dialog->SetAutoClose(autoCloseTime);
  dialog->m_bCanceled = false;
  dialog->m_bCustom = false;
  dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106);
  dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107);
  dialog->SetChoice(2, customLabel);  // Button only visible when label is not empty

  dialog->Open();

  if (dialog->m_bCanceled)
    return -1;
  else if (dialog->m_bCustom)
    return 2;
  else if (dialog->IsConfirmed())
    return 1;
  else
    return 0;
}
Example #2
0
    bool Dialog::yesno(const String& heading, const String& line1, 
                       const String& line2,
                       const String& line3,
                       const String& nolabel,
                       const String& yeslabel,
                       int autoclose)
    {
      DelayedCallGuard dcguard(languageHook);
      CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
      if (pDialog == NULL)
        throw WindowException("Error: Window is NULL, this is not possible :-)");

      // get lines, last 4 lines are optional.
      if (!heading.empty())
        pDialog->SetHeading(CVariant{heading});
      if (!line1.empty())
        pDialog->SetLine(0, CVariant{line1});
      if (!line2.empty())
        pDialog->SetLine(1, CVariant{line2});
      if (!line3.empty())
        pDialog->SetLine(2, CVariant{line3});

      if (!nolabel.empty())
        pDialog->SetChoice(0, CVariant{nolabel});
      if (!yeslabel.empty())
        pDialog->SetChoice(1, CVariant{yeslabel});

      if (autoclose > 0)
        pDialog->SetAutoClose(autoclose);

      pDialog->Open();

      return pDialog->IsConfirmed();
    }
Example #3
0
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant text, bool &bCanceled, CVariant noLabel /* = "" */, CVariant yesLabel /* = "" */, unsigned int autoCloseTime)
{
  CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
  if (!dialog)
    return false;

  dialog->SetHeading(heading);
  dialog->SetText(text);
  if (autoCloseTime)
    dialog->SetAutoClose(autoCloseTime);
  dialog->m_bCanceled = false;
  dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106);
  dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107);
  dialog->Open();

  bCanceled = dialog->m_bCanceled;
  return (dialog->IsConfirmed()) ? true : false;
}
Example #4
0
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant line0, CVariant line1, CVariant line2, bool &bCanceled, CVariant noLabel, CVariant yesLabel, unsigned int autoCloseTime /* = 0 */)
{
  CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
  if (!dialog)
    return false;

  dialog->SetHeading(heading);
  dialog->SetLine(0, line0);
  dialog->SetLine(1, line1);
  dialog->SetLine(2, line2);
  if (autoCloseTime)
    dialog->SetAutoClose(autoCloseTime);
  dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106);
  dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107);
  dialog->m_bCanceled = false;
  dialog->DoModal();

  bCanceled = dialog->m_bCanceled;
  return (dialog->IsConfirmed()) ? true : false;
}
Example #5
0
bool CGUIDialogYesNo::ShowAndGetInput(CVariant heading, CVariant line0, CVariant line1, CVariant line2, bool &bCanceled, CVariant noLabel, CVariant yesLabel, unsigned int autoCloseTime)
{
  CGUIDialogYesNo *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);
  if (!dialog)
    return false;

  dialog->SetHeading(heading);
  dialog->SetLine(0, line0);
  dialog->SetLine(1, line1);
  dialog->SetLine(2, line2);
  if (autoCloseTime)
    dialog->SetAutoClose(autoCloseTime);
  dialog->SetChoice(0, !noLabel.empty() ? noLabel : 106);
  dialog->SetChoice(1, !yesLabel.empty() ? yesLabel : 107);
  dialog->SetChoice(2, "");
  dialog->m_bCanceled = false;
  dialog->Open();

  bCanceled = dialog->m_bCanceled;
  return (dialog->IsConfirmed()) ? true : false;
}
Example #6
0
bool CGUIDialogYesNo::ShowAndGetInput(int heading, int line0, int line1, int line2, int iNoLabel, int iYesLabel, bool& bCanceled, unsigned int autoCloseTime)
{
  CGUIDialogYesNo *dialog = (CGUIDialogYesNo *)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
  if (!dialog) return false;
  dialog->SetHeading(heading);
  dialog->SetLine(0, line0);
  dialog->SetLine(1, line1);
  dialog->SetLine(2, line2);
  if (autoCloseTime)
    dialog->SetAutoClose(autoCloseTime);
  if (iNoLabel != -1)
    dialog->SetChoice(0,iNoLabel);
  else
    dialog->SetChoice(0,106);
  if (iYesLabel != -1)
    dialog->SetChoice(1,iYesLabel);
  else
    dialog->SetChoice(1,107);
  dialog->m_bCanceled = false;
  dialog->DoModal();
  bCanceled = dialog->m_bCanceled;
  return (dialog->IsConfirmed()) ? true : false;
}
Example #7
0
bool Dialog::yesno(const String& heading, const String& line1,
                   const String& line2,
                   const String& line3,
                   const String& nolabel,
                   const String& yeslabel,
                   int autoclose) throw (WindowException)
{
    DelayedCallGuard dcguard(languageHook);
    const int window = WINDOW_DIALOG_YES_NO;
    CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(window);
    if (pDialog == NULL)
        throw WindowException("Error: Window is NULL, this is not possible :-)");

    // get lines, last 4 lines are optional.
    if (!heading.empty())
        pDialog->SetHeading(heading);
    if (!line1.empty())
        pDialog->SetLine(0, line1);
    if (!line2.empty())
        pDialog->SetLine(1, line2);
    if (!line3.empty())
        pDialog->SetLine(2, line3);

    if (!nolabel.empty())
        pDialog->SetChoice(0,nolabel);
    if (!yeslabel.empty())
        pDialog->SetChoice(1,yeslabel);

    if (autoclose > 0)
        pDialog->SetAutoClose(autoclose);

    //send message and wait for user input
    XBMCWaitForThreadMessage(TMSG_DIALOG_DOMODAL, window, ACTIVE_WINDOW);

    return pDialog->IsConfirmed();
}
void CGUIWindowBoxeeWizardResolution::OnInitWindow()
{
   CGUIWindow::OnInitWindow();
   
   delete m_xrandr;
   m_xrandr = new CXRandR();
   
   if (!m_wizardCompletedOnce)
   {             
      CONTROL_DISABLE(CONTROL_NEXT);
   }
   
   if (m_afterResolutionChange)
   {
       CGUIListContainer *pList = (CGUIListContainer *)GetControl(CONTROL_SD_HD);
       if (pList)
         pList->SetSingleSelectedItem();

      ShowResolutionsList(IsResolutionHD(m_newResolution), &m_newResolution);     
      
      CStdString origHz;
      origHz.Format("%.2f", m_originalResolution.hz);
      CStdString newHz;
      newHz.Format("%.2f", m_newResolution.hz);

      if (m_newResolution.name != m_originalResolution.name || origHz != newHz)
      {
         CGUIDialogYesNo *pDlgYesNo = (CGUIDialogYesNo*)m_gWindowManager.GetWindow(WINDOW_DIALOG_YES_NO);
         pDlgYesNo->SetHeading("Resolution Change");
         pDlgYesNo->SetLine(0, "Do you want to keep this resolution");
         pDlgYesNo->SetLine(1, "(will revert automatically in 6 seconds)");
         pDlgYesNo->SetLine(2, "");
         pDlgYesNo->SetLine(3, "");
         pDlgYesNo->SetChoice(0, "Revert");
         pDlgYesNo->SetChoice(1, "Keep");
         pDlgYesNo->SetDefaultChoice(0);
         pDlgYesNo->SetAutoClose(6000);
         pDlgYesNo->DoModal();
         
         if (!pDlgYesNo->IsConfirmed())
         {
           m_afterResolutionChange = false;   
           // Set the requested resolution
           g_graphicsContext.SetVideoResolution(m_originalResolutionId, TRUE);
           // Reload the fonts to they will scale correctly
           g_fontManager.ReloadTTFFonts();
           // Close the dialog and restart it so it will re-set the size of the labels to 
           // fit for the new resolutions
           Close();
                    
           m_gWindowManager.ActivateWindow(WINDOW_BOXEE_WIZARD_RESOLUTION);
         }
         else
         {
            int xbmcResolutionId = GetXBMCResolutionId();
            if (xbmcResolutionId != -1)
            {
               g_guiSettings.SetInt("videoscreen.resolution", xbmcResolutionId);
               g_guiSettings.SetInt("videoplayer.displayresolution", xbmcResolutionId);
               g_guiSettings.SetInt("pictures.displayresolution", xbmcResolutionId);
               g_settings.Save();
               delete m_xrandr;
               m_xrandr = new CXRandR();
            }
         
            m_wizardCompletedOnce = true;
            CONTROL_ENABLE(CONTROL_NEXT);
            SET_CONTROL_FOCUS(CONTROL_NEXT, 0);            
         }
      }
      else
      {
         m_wizardCompletedOnce = true;
         CONTROL_ENABLE(CONTROL_NEXT);
         SET_CONTROL_FOCUS(CONTROL_NEXT, 0);         
      }
   }
   else if (m_resolutionChangedOnce || m_wizardCompletedOnce)
   {
      XOutput output = GetCurrentOutput();
      XMode currentResolution =  m_xrandr->GetCurrentMode(output.name);
      ShowResolutionsList(IsResolutionHD(currentResolution), &currentResolution);      
   }
   else
   {
      XOutput output = GetCurrentOutput();
      XMode currentResolution =  m_xrandr->GetCurrentMode(output.name);
      CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_SD_HD, IsResolutionHD(currentResolution) ? VALUE_HD : VALUE_SD);
      OnMessage(msg); 
   }
}