void CGUIDialogPVRChannelManager::SetData(int iItem)
{
  CGUIEditControl        *pEdit;
  CGUIRadioButtonControl *pRadioButton;

  /* Check file item is in list range and get his pointer */
  if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return;

  CFileItemPtr pItem = m_channelItems->Get(iItem);
  if (!pItem)
    return;

  pEdit = (CGUIEditControl *)GetControl(EDIT_NAME);
  if (pEdit)
  {
    pEdit->SetLabel2(pItem->GetProperty("Name").asString());
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, 19208);
  }

  pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_ACTIVE);
  if (pRadioButton) pRadioButton->SetSelected(pItem->GetProperty("ActiveChannel").asBoolean());

  pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_USEEPG);
  if (pRadioButton) pRadioButton->SetSelected(pItem->GetProperty("UseEPG").asBoolean());

  pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_PARENTAL_LOCK);
  if (pRadioButton) pRadioButton->SetSelected(pItem->GetProperty("ParentalLocked").asBoolean());
}
예제 #2
0
bool CGUIDialogBoxeeBrowseMenu::OnMessage(CGUIMessage& message)
{
  switch ( message.GetMessage() )
  {
  case GUI_MSG_WINDOW_INIT:
  {
    CStdString param = message.GetStringParam(0);
    m_openInSearch = (param == "openinsearch");
  }
  break;
  case GUI_MSG_LABEL2_SET:
  {
    CGUIDialogBoxeeSearch *pSearchDialog = (CGUIDialogBoxeeSearch*)g_windowManager.GetWindow(WINDOW_DIALOG_BOXEE_SEARCH);
    if (pSearchDialog && pSearchDialog->ClosedByMovingRightFromTextBox())
    {
      CAction action;
      action.id = ACTION_MOVE_RIGHT;
      OnAction(action);
    }
  }
  break;
  case GUI_MSG_CLICKED:
  {
    int iControl = message.GetSenderId();

    if (iControl == BROWSE_MENU_BUTTON_SEARCH)
    {
      // Get the keystroke that was pressed
      bool bResult = CGUIDialog::OnMessage(message);

      SET_CONTROL_FOCUS(BROWSE_MENU_BUTTON_SEARCH,0);

      CGUIEditControl* pSearchControl = (CGUIEditControl*)GetControl(BROWSE_MENU_BUTTON_SEARCH);
      if (pSearchControl)
      {
        CStdString strSearchTerm = pSearchControl->GetLabel2();
        //pSearchControl->SetLabel2("");

        CLog::Log(LOGDEBUG,"CGUIDialogBoxeeBrowseMenu::OnMessage - [term=%s] (search)",  strSearchTerm.c_str());

        ThreadMessage tMsg(TMSG_GUI_ACTIVATE_WINDOW , WINDOW_DIALOG_BOXEE_SEARCH , false);
        std::vector<CStdString> params;
        params.push_back(strSearchTerm);
        tMsg.params = params;
        g_application.getApplicationMessenger().SendMessage(tMsg,false);
      }

      return bResult;
    }

    OnClick(iControl);
  }
  break;
  }

  return CGUIDialog::OnMessage(message);
}
예제 #3
0
void CGUIDialogSmartPlaylistRule::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  UpdateButtons();

  CGUIEditControl *editControl = dynamic_cast<CGUIEditControl*>(GetControl(CONTROL_VALUE));
  if (editControl != NULL)
    editControl->SetInputValidation(CSmartPlaylistRule::Validate, &m_rule);
}
void CGUIDialogBoxeeOTAZipcodeLocationConfiguration::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  CGUIEditControl *editControl = (CGUIEditControl *)GetControl(CONTROL_ZIP_CODE_EDIT);
  if (editControl)
    editControl->SetLabel2(CBoxeeOTAConfigurationManager::GetInstance().GetConfigurationData().GetZipCode());

  SET_CONTROL_FOCUS(CONTROL_ZIP_CODE_EDIT, 0);
}
예제 #5
0
void CGUIDialogKeyboardGeneric::OnWindowLoaded()
{
  // show the cursor always
  CGUIEditControl *edit = (CGUIEditControl *)GetControl(CTL_EDIT);
  if (edit)
    edit->SetShowCursorAlways(true);
  g_Windowing.EnableTextInput(false);

  CGUIDialog::OnWindowLoaded();
}
bool CGUIDialogBoxeeOTAZipcodeLocationConfiguration::HandleSelectZipCode()
{
  CGUIEditControl *editControl = (CGUIEditControl *)GetControl(CONTROL_ZIP_CODE_EDIT);
  if (!editControl)
  {
    return false;
  }

  CStdString zipCode = editControl->GetLabel2();
  CBoxeeOTAConfigurationManager::GetInstance().GetConfigurationData().SetZipCode(zipCode);

  return true;
}
예제 #7
0
파일: Edit.cpp 프로젝트: Arcko/xbmc
void Interface_GUIControlEdit::set_enabled(void* kodiBase, void* handle, bool enable)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
  if (!addon || !control)
  {
    CLog::Log(LOGERROR, "Interface_GUIControlEdit::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
                          __FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
    return;
  }

  control->SetEnabled(enable);
}
예제 #8
0
파일: Edit.cpp 프로젝트: Arcko/xbmc
unsigned int Interface_GUIControlEdit::get_cursor_position(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
  if (!addon || !control)
  {
    CLog::Log(LOGERROR, "Interface_GUIControlEdit::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
                          __FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
    return 0;
  }

  return control->GetCursorPosition();
}
예제 #9
0
파일: Edit.cpp 프로젝트: Arcko/xbmc
char* Interface_GUIControlEdit::get_text(void* kodiBase, void* handle)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
  if (!addon || !control)
  {
    CLog::Log(LOGERROR, "Interface_GUIControlEdit::%s - invalid handler data (kodiBase='%p', handle='%p') on addon '%s'",
                          __FUNCTION__, kodiBase, handle, addon ? addon->ID().c_str() : "unknown");
    return nullptr;
  }

  return strdup(control->GetLabel2().c_str());
}
예제 #10
0
파일: Edit.cpp 프로젝트: Arcko/xbmc
void Interface_GUIControlEdit::set_text(void* kodiBase, void* handle, const char* text)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
  if (!addon || !control || !text)
  {
    CLog::Log(LOGERROR, "Interface_GUIControlEdit::%s - invalid handler data (kodiBase='%p', handle='%p', text='%p') on addon '%s'",
                          __FUNCTION__, kodiBase, handle, text, addon ? addon->ID().c_str() : "unknown");
    return;
  }

  control->SetLabel2(text);
}
예제 #11
0
파일: Edit.cpp 프로젝트: Arcko/xbmc
void Interface_GUIControlEdit::set_input_type(void* kodiBase, void* handle, int type, const char *heading)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  CGUIEditControl* control = static_cast<CGUIEditControl*>(handle);
  if (!addon || !control || !heading)
  {
    CLog::Log(LOGERROR, "Interface_GUIControlEdit::%s - invalid handler data (kodiBase='%p', handle='%p', heading='%p') on addon '%s'",
                          __FUNCTION__, kodiBase, handle, heading, addon ? addon->ID().c_str() : "unknown");
    return;
  }

  CGUIEditControl::INPUT_TYPE kodiType;
  switch (static_cast<AddonGUIInputType>(type))
  {
    case ADDON_INPUT_TYPE_TEXT:
      kodiType = CGUIEditControl::INPUT_TYPE_TEXT;
      break;
    case ADDON_INPUT_TYPE_NUMBER:
      kodiType = CGUIEditControl::INPUT_TYPE_NUMBER;
      break;
    case ADDON_INPUT_TYPE_SECONDS:
      kodiType = CGUIEditControl::INPUT_TYPE_SECONDS;
      break;
    case ADDON_INPUT_TYPE_TIME:
      kodiType = CGUIEditControl::INPUT_TYPE_TIME;
      break;
    case ADDON_INPUT_TYPE_DATE:
      kodiType = CGUIEditControl::INPUT_TYPE_DATE;
      break;
    case ADDON_INPUT_TYPE_IPADDRESS:
      kodiType = CGUIEditControl::INPUT_TYPE_IPADDRESS;
      break;
    case ADDON_INPUT_TYPE_PASSWORD:
      kodiType = CGUIEditControl::INPUT_TYPE_PASSWORD;
      break;
    case ADDON_INPUT_TYPE_PASSWORD_MD5:
      kodiType = CGUIEditControl::INPUT_TYPE_PASSWORD_MD5;
      break;
    case ADDON_INPUT_TYPE_SEARCH:
      kodiType = CGUIEditControl::INPUT_TYPE_SEARCH;
      break;
    case ADDON_INPUT_TYPE_FILTER:
      kodiType = CGUIEditControl::INPUT_TYPE_FILTER;
      break;
    case ADDON_INPUT_TYPE_READONLY:
    default:
      kodiType = CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW;
  }

  control->SetInputType(kodiType, heading);
}
예제 #12
0
bool CGUIDialogBoxeeBrowseMenu::OnAction(const CAction &action)
{
  switch (action.id)
  {
  case ACTION_PARENT_DIR:
  case ACTION_PREVIOUS_MENU:
  {
    Close();
    return true;
  }
  break;
  case ACTION_MOUSE:
  case ACTION_MOVE_LEFT:
  case ACTION_MOVE_RIGHT:
  case ACTION_MOVE_UP:
  case ACTION_MOVE_DOWN:
  {
    // Call parent to perform the actual action
    bool bResult = CGUIDialog::OnAction(action);

    return bResult;
  }
  break;
  default:
  {
    // do nothing
  }
  break;
  }

  // Pass along all key presses to the edit control
  if (action.id >= KEY_ASCII)
  {
    CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), BROWSE_MENU_BUTTON_SEARCH);
    OnMessage(msg);

    m_iCurrentButtonId = BROWSE_MENU_BUTTON_SEARCH;

    CGUIEditControl* pSearchControl = (CGUIEditControl*)GetControl(BROWSE_MENU_BUTTON_SEARCH);
    if (pSearchControl)
    {
      pSearchControl->OnAction(action);
    }

    return true;
  }

  return CGUIDialog::OnAction(action);
}
예제 #13
0
void CGUIDialogBoxeeShare::OnInitWindow()
{
  CGUIWindow::OnInitWindow();

  m_strText = GetDefaultShareText();
  
  // Send the item to the special container to allow skin access
  CFileItemPtr itemPtr(new CFileItem(m_item));
  CGUIMessage winmsg(GUI_MSG_LABEL_ADD, GetID(), HIDDEN_CONTAINER, 0, 0, itemPtr);
  g_windowManager.SendMessage(winmsg);
  
  CGUIEditControl* editControl = (CGUIEditControl*)GetControl(EDIT_CONTROL);
  if (editControl)
  {
    editControl->SetLabel2(m_strText);
    CGUIWindow* activeWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
    if (activeWindow)
    {
      CStdString leftToInput = BOXEE::BXUtils::IntToString(editControl->GetMaxInputSize() - (int)editControl->GetLabel2().size());
      activeWindow->SetProperty(LEFT_TO_INPUT_SIZE,leftToInput);
    }
  }

  // Set the user profile thumb - start
  CProfile profile = g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex];

  CFileItemPtr item(new CFileItem(profile.getName()));
  CStdString strLabel;

  if (profile.getDate().IsEmpty())
    strLabel = g_localizeStrings.Get(20113);
  else
    strLabel.Format(g_localizeStrings.Get(20112),profile.getDate());

  item->SetLabel2(strLabel);
  item->SetThumbnailImage(profile.getThumb());
  item->SetCachedPictureThumb();
  if (profile.getThumb().IsEmpty() || profile.getThumb().Equals("-"))
    item->SetThumbnailImage("unknown-user.png");

  item->SetLabelPreformated(true);

  CGUIMessage winmsg2(GUI_MSG_LABEL_ADD, GetID(), USER_INFO_CONTAINER, 0, 0, item);
  g_windowManager.SendMessage(winmsg2);

  UpdateShareDialog();

  SET_CONTROL_FOCUS(SHARE_BTN,0);
}
예제 #14
0
void CGUIDialogKeyboardGeneric::OnWindowLoaded()
{
  CGUIEditControl *edit = static_cast<CGUIEditControl*>(GetControl(CTL_EDIT));
  if (edit)
  {
    // add control CTL_LABEL_HZCODE and CTL_LABEL_HZLIST if not exist
    CGUIControlGroup *ParentControl = static_cast<CGUIControlGroup*>(edit->GetParentControl());
    CLabelInfo labelInfo = edit->GetLabelInfo();
    float px = edit->GetXPosition();
    float py = edit->GetYPosition();
    float pw = edit->GetWidth();
    float ph = edit->GetHeight();

    CGUILabelControl* control = static_cast<CGUILabelControl*>(GetControl(CTL_LABEL_HZCODE));
    if (!control)
    {
      control = new CGUILabelControl(GetID(), CTL_LABEL_HZCODE, px, py + ph, 90, 30, labelInfo, false, false);
      ParentControl->AddControl(control);
    }

    control = static_cast<CGUILabelControl*>(GetControl(CTL_LABEL_HZLIST));
    if (!control)
    {
      labelInfo.align = XBFONT_CENTER_Y;
      control = new CGUILabelControl(GetID(), CTL_LABEL_HZLIST, px + 95, py + ph, pw - 95, 30, labelInfo, false, false);
      ParentControl->AddControl(control);
    }
  }

  CGUIDialog::OnWindowLoaded();
}
void CGUIDialogSmartPlaylistRule::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  // add the fields to the field spincontrol
  std::vector< std::pair<std::string, int> > labels;
  std::vector<Field> fields = CSmartPlaylistRule::GetFields(m_type);
  for (unsigned int i = 0; i < fields.size(); i++)
    labels.push_back(std::make_pair(CSmartPlaylistRule::GetLocalizedField(fields[i]), fields[i]));

  SET_CONTROL_LABELS(CONTROL_FIELD, 0, &labels);

  UpdateButtons();

  CGUIEditControl *editControl = dynamic_cast<CGUIEditControl*>(GetControl(CONTROL_VALUE));
  if (editControl != NULL)
    editControl->SetInputValidation(CSmartPlaylistRule::Validate, &m_rule);
}
bool CGUIDialogPVRChannelManager::OnClickButtonEditName(CGUIMessage &message)
{
  CGUIEditControl *pEdit = (CGUIEditControl *)GetControl(EDIT_NAME);
  if (pEdit)
  {
    CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
    if (pItem)
    {
      pItem->SetProperty("Changed", true);
      pItem->SetProperty("Name", pEdit->GetLabel2());
      m_bContainsChanges = true;

      return true;
    }
  }

  return false;
}
예제 #17
0
void CGUIWindow::ChangeButtonToEdit(int id, bool singleLabel /* = false*/)
{
#ifdef PRE_SKIN_VERSION_9_10_COMPATIBILITY
  CGUIControl *name = (CGUIControl *)GetControl(id);
  if (name && name->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
  { // change it to an edit control
    CGUIEditControl *edit = new CGUIEditControl(*(const CGUIButtonControl *)name);
    if (edit)
    {
      if (singleLabel)
        edit->SetLabel("");
      InsertControl(edit, name);
      RemoveControl(name);
      name->FreeResources();
      delete name;
    }
  }
#endif
}
void CGUIDialogSmartPlaylistRule::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  SendMessage(GUI_MSG_LABEL_RESET, CONTROL_FIELD);
  // add the fields to the field spincontrol
  vector<Field> fields = CSmartPlaylistRule::GetFields(m_type);
  for (unsigned int i = 0; i < fields.size(); i++)
  {
    CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_FIELD, fields[i]);
    msg.SetLabel(CSmartPlaylistRule::GetLocalizedField(fields[i]));
    OnMessage(msg);
  }
  UpdateButtons();

  CGUIEditControl *editControl = (CGUIEditControl*)GetControl(CONTROL_VALUE);
  if (editControl != NULL)
    editControl->SetInputValidation(CSmartPlaylistRule::Validate, &m_rule);
}
예제 #19
0
void CGUIDialogKeyboardGeneric::OnWindowLoaded()
{
  CGUIEditControl *edit = (CGUIEditControl *)GetControl(CTL_EDIT);
  if (!edit && g_SkinInfo && g_SkinInfo->APIVersion() < ADDON::AddonVersion("5.2.0"))
  {
    // backward compatibility: convert label to edit control
    CGUILabelControl *label = (CGUILabelControl *)GetControl(CTL_LABEL_EDIT);
    if (label && label->GetControlType() == CGUIControl::GUICONTROL_LABEL)
    {
      // create a new edit control positioned in the same spot
      edit = new CGUIEditControl(label->GetParentID(), CTL_EDIT, label->GetXPosition(), label->GetYPosition(),
                                 label->GetWidth(), label->GetHeight(), CTextureInfo(), CTextureInfo(),
                                 label->GetLabelInfo(), "");
      AddControl(edit);
      m_defaultControl = CTL_EDIT;
      m_defaultAlways  = true;
    }
  }
  // show the cursor always
  if (edit)
    edit->SetShowCursorAlways(true);

  CGUIDialog::OnWindowLoaded();
}
예제 #20
0
CStdString CGUIDialogBoxeeBrowseMenu::GetSearchTerm()
{
  CGUIEditControl* pSearchControl = (CGUIEditControl*)GetControl(BROWSE_MENU_BUTTON_SEARCH);
  return pSearchControl->GetLabel2();
}
예제 #21
0
void CGUIDialogBoxeeBrowseMenu::OnInitWindow()
{
  if (!CanOpenBrowseMenu())
  {
    Close(true);
    return;
  }

  CGUIDialog::OnInitWindow();

  m_downloadCounter = 0;

  //CLog::Log(LOGDEBUG, "CGUIDialogBoxeeBrowseMenu::OnInitWindow - [CurrentRow=%d][CurrentButton=%d][StartActionId=%d] (browsemenu)", m_iCurrentRowIndex, m_iCurrentButtonId,m_startAction.id);

//  if (!g_application.IsPlaying() && m_iCurrentButtonId == 102)
//  {
//    m_iCurrentButtonId = BROWSE_MENU_BUTTON_HOME;
//    CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), m_iCurrentButtonId);
//    OnMessage(msg);
//    m_iCurrentRowIndex = 0;
//    SetSelectedButtonInRow(0);
//  }

  if (m_openInSearch)
  {
    CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), BROWSE_MENU_BUTTON_SEARCH);
    OnMessage(msg);

    m_iCurrentButtonId = BROWSE_MENU_BUTTON_SEARCH;
    return;
  }

  if (m_startAction.id != 0)
  {
    CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), BROWSE_MENU_BUTTON_SEARCH);
    OnMessage(msg);

    m_iCurrentButtonId = BROWSE_MENU_BUTTON_SEARCH;

    CGUIEditControl* pSearchControl = (CGUIEditControl*)GetControl(BROWSE_MENU_BUTTON_SEARCH);
    if (pSearchControl)
    {
      pSearchControl->OnAction(m_startAction);
    }

    ResetAction();
  }

  int iCurrentWindow = g_windowManager.GetActiveWindow();
  bool setFocusOnButton = false;
  if ((m_iCurrentWindowId != iCurrentWindow) || (!g_application.IsPlaying() && m_iCurrentButtonId == BTN_NOW_PLAYING))
  {
    m_iCurrentWindowId = iCurrentWindow;
    setFocusOnButton = true;
    switch(iCurrentWindow)
    {
    case WINDOW_BOXEE_BROWSE_MOVIES:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_MOVIES;
    }
    break;
    case WINDOW_BOXEE_BROWSE_TVSHOWS:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_TV;
    }
    break;
    case WINDOW_BOXEE_BROWSE_APPS:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_APPS;
    }
    break;
    case WINDOW_BOXEE_BROWSE_LOCAL:
    case WINDOW_BOXEE_BROWSE_ALBUMS:
    case WINDOW_BOXEE_BROWSE_PHOTOS:
    case WINDOW_BOXEE_BROWSE_TRACKS:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_FILES;
    }
    break;
    case WINDOW_BOXEE_BROWSE_DISCOVER:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_FRIENDS;
    }
    break;
    case WINDOW_BOXEE_BROWSE_QUEUE:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_WATCH_LATER;
    }
    break;
    case WINDOW_BOXEE_LIVETV:
    {
      m_iCurrentButtonId = BROWSE_MENU_BUTTON_LIVETV;
    }
    break;
    default:
    {
      setFocusOnButton = false;
    }
    break;
    }

    if (setFocusOnButton)
    {
      CGUIMessage msg(GUI_MSG_SETFOCUS, GetID(), MENU_BUTTONS_LIST,m_iCurrentButtonId);
      OnMessage(msg);
    }
  }

}
예제 #22
0
void CGUIDialogSettings::OnClick(int iID)
{
  if (iID == CONTROL_OKAY_BUTTON)
  {
    OnOkay();
    Close();
    return;
  }
  if (iID == CONTROL_CANCEL_BUTTON)
  {
    OnCancel();
    Close();
    return;
  }
  unsigned int settingNum = iID - CONTROL_START;
  if (settingNum >= m_settings.size()) return;
  SettingInfo &setting = m_settings.at(settingNum);
  if (setting.type == SettingInfo::SPIN)
  {
    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID);
    if (setting.data) *(int *)setting.data = pControl->GetValue();
  }
  else if (setting.type == SettingInfo::BUTTON_DIALOG)
  {
    CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(iID);
    if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
  }
  else if (setting.type == SettingInfo::EDIT)
  {
    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
    if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
  }
  else if (setting.type == SettingInfo::EDIT_NUM)
  {
    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
    if (setting.data) {
        CStdString strIndex = pControl->GetLabel2();
        *(int *)setting.data = atol(strIndex.c_str());
    }
  }
  else if (setting.type == SettingInfo::CHECK)
  {
    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
    if (setting.data) *(bool *)setting.data = pControl->IsSelected();
  }
  else if (setting.type == SettingInfo::CHECK_UCHAR)
  {
    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
    if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0;
  }
  else if (setting.type == SettingInfo::SLIDER)
  {
    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
    if (setting.data) *(float *)setting.data = pControl->GetFloatValue();
    if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(pControl->GetFloatValue(), setting.interval));
  }
  else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data)
  { // we're using popup sliders
    CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting);
    if (setting.formatFunction)
      SET_CONTROL_LABEL2(iID, setting.formatFunction(*(float *)setting.data, setting.interval));
  }
  OnSettingChanged(setting);
}
예제 #23
0
void CGUIDialogSettings::UpdateSetting(unsigned int id)
{
  unsigned int settingNum = (unsigned int)-1;
  for (unsigned int i = 0; i < m_settings.size(); i++)
  {
    if (m_settings[i].id == id)
    {
      settingNum = i;
      break;
    }
  }
  if(settingNum == (unsigned int)-1)
    return;

  SettingInfo &setting = m_settings.at(settingNum);
  unsigned int controlID = settingNum + CONTROL_START;
  if (setting.type == SettingInfo::SPIN)
  {
    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
    if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
  }
  else if (setting.type == SettingInfo::CHECK)
  {
    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
    if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
  }
  else if (setting.type == SettingInfo::CHECK_UCHAR)
  {
    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
    if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
  }
  else if (setting.type == SettingInfo::SLIDER)
  {
    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
    float value = *(float *)setting.data;
    if (pControl && setting.data)
    {
      pControl->SetFloatValue(value);
      if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(value, setting.interval));
    }
  }
  else if (setting.type == SettingInfo::BUTTON_DIALOG)
  {
    SET_CONTROL_LABEL(controlID,setting.name);
    CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(controlID);
    if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
  }
  else if (setting.type == SettingInfo::EDIT)
  {
    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
    if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
  }
  else if (setting.type == SettingInfo::EDIT_NUM)
  {
    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
    if (pControl && setting.data) {
      CStdString strIndex;
      strIndex.Format("%i", *(int *)setting.data);
      pControl->SetLabel2(strIndex);
    }
  }

  if (setting.enabled)
  {
    CONTROL_ENABLE(controlID);
  }
  else
  {
    CONTROL_DISABLE(controlID);
  }
}
예제 #24
0
bool CGUIDialogPVRChannelManager::OnMessage(CGUIMessage& message)
{
  unsigned int iControl = 0;
  unsigned int iMessage = message.GetMessage();

  switch (iMessage)
  {
    case GUI_MSG_WINDOW_DEINIT:
    {
      Clear();
    }
    break;

    case GUI_MSG_WINDOW_INIT:
    {
      CGUIWindow::OnMessage(message);
      m_iSelected = 0;
      m_bIsRadio = false;
      m_bMovingMode = false;
      m_bContainsChanges = false;
      SetProperty("IsRadio", "");
      Update();
      SetData(m_iSelected);
      return true;
    }
    break;

    case GUI_MSG_CLICKED:
    {
      iControl = message.GetSenderId();
      if (iControl == CONTROL_LIST_CHANNELS)
      {
        if (!m_bMovingMode)
        {
          int iAction = message.GetParam1();
          int iItem = m_viewControl.GetSelectedItem();

          /* Check file item is in list range and get his pointer */
          if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return true;

          /* Process actions */
          if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_RIGHT_CLICK)
          {
            /* Show Contextmenu */
            OnPopupMenu(iItem);
          }
        }
        else
        {
          CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
          if (pItem)
          {
            pItem->SetProperty("Changed", true);
            pItem->Select(false);
            m_bMovingMode = false;
            m_bContainsChanges = true;
            return true;
          }
          else
            return false;
        }
      }
      else if (iControl == BUTTON_OK)
      {
        SaveList();
        Close();
        return true;
      }
      else if (iControl == BUTTON_APPLY)
      {
        SaveList();
        return true;
      }
      else if (iControl == BUTTON_CANCEL)
      {
        Close();
        return true;
      }
      else if (iControl == BUTTON_RADIO_TV)
      {
        if (m_bContainsChanges)
        {
          // prompt user for confirmation of channel record
          CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
          if (!pDialog)
            return true;

          pDialog->SetHeading(20052);
          pDialog->SetLine(0, "");
          pDialog->SetLine(1, 19212);
          pDialog->SetLine(2, 20103);
          pDialog->DoModal();

          if (pDialog->IsConfirmed())
            SaveList();
        }

        m_iSelected = 0;
        m_bMovingMode = false;
        m_bContainsChanges = false;
        m_bIsRadio = !m_bIsRadio;
        SetProperty("IsRadio", m_bIsRadio ? "true" : "");
        Update();
        SetData(m_iSelected);
        return true;
      }
      else if (iControl == RADIOBUTTON_ACTIVE)
      {
        CGUIRadioButtonControl *pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_ACTIVE);
        if (pRadioButton)
        {
          CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
          if (pItem)
          {
            pItem->SetProperty("Changed", true);
            pItem->SetProperty("ActiveChannel", pRadioButton->IsSelected());
            m_bContainsChanges = true;
            Renumber();
          }
        }
      }
      else if (iControl == EDIT_NAME)
      {
        CGUIEditControl *pEdit = (CGUIEditControl *)GetControl(EDIT_NAME);
        if (pEdit)
        {
          CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
          if (pItem)
          {
            pItem->SetProperty("Changed", true);
            pItem->SetProperty("Name", pEdit->GetLabel2());
            m_bContainsChanges = true;
          }
        }
      }
      else if (iControl == BUTTON_CHANNEL_LOGO)
      {
        CFileItemPtr pItem = m_channelItems->Get(m_iSelected);

        if (!pItem)
          return false;
        if (g_settings.GetCurrentProfile().canWriteSources() && !g_passwordManager.IsProfileLockUnlocked())
          return false;
        else if (!g_passwordManager.IsMasterLockUnlocked(true))
          return false;

        // setup our thumb list
        CFileItemList items;

        // add the current thumb, if available
        if (!pItem->GetProperty("Icon").IsEmpty())
        {
          CFileItemPtr current(new CFileItem("thumb://Current", false));
          current->SetThumbnailImage(pItem->GetPVRChannelInfoTag()->IconPath());
          current->SetLabel(g_localizeStrings.Get(20016));
          items.Add(current);
        }
        else if (pItem->HasThumbnail())
        { // already have a thumb that the share doesn't know about - must be a local one, so we mayaswell reuse it.
          CFileItemPtr current(new CFileItem("thumb://Current", false));
          current->SetThumbnailImage(pItem->GetThumbnailImage());
          current->SetLabel(g_localizeStrings.Get(20016));
          items.Add(current);
        }

        // and add a "no thumb" entry as well
        CFileItemPtr nothumb(new CFileItem("thumb://None", false));
        nothumb->SetIconImage(pItem->GetIconImage());
        nothumb->SetLabel(g_localizeStrings.Get(20018));
        items.Add(nothumb);

        CStdString strThumb;
        VECSOURCES shares;
        if (g_guiSettings.GetString("pvrmenu.iconpath") != "")
        {
          CMediaSource share1;
          share1.strPath = g_guiSettings.GetString("pvrmenu.iconpath");
          share1.strName = g_localizeStrings.Get(19018);
          shares.push_back(share1);
        }
        g_mediaManager.GetLocalDrives(shares);
        if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb))
          return false;

        if (strThumb == "thumb://Current")
          return true;

        if (strThumb == "thumb://None")
          strThumb = "";

        pItem->SetProperty("Icon", strThumb);
        pItem->SetProperty("Changed", true);
        m_bContainsChanges = true;
        return true;
      }
      else if (iControl == RADIOBUTTON_USEEPG)
      {
        CGUIRadioButtonControl *pRadioButton = (CGUIRadioButtonControl *)GetControl(RADIOBUTTON_USEEPG);
        if (pRadioButton)
        {
          CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
          if (pItem)
          {
            pItem->SetProperty("Changed", true);
            pItem->SetProperty("UseEPG", pRadioButton->IsSelected());
            m_bContainsChanges = true;
          }
        }
      }
      else if (iControl == SPIN_EPGSOURCE_SELECTION)
      {
        /// TODO: Add EPG scraper support
        return true;
        CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(SPIN_EPGSOURCE_SELECTION);
        if (pSpin)
        {
          CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
          if (pItem)
          {
            pItem->SetProperty("EPGSource", (int)0);
            pItem->SetProperty("Changed", true);
            m_bContainsChanges = true;
            return true;
          }
        }
      }
      else if (iControl == BUTTON_GROUP_MANAGER)
      {
        /* Load group manager dialog */
        CGUIDialogPVRGroupManager* pDlgInfo = (CGUIDialogPVRGroupManager*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GROUP_MANAGER);
        if (!pDlgInfo)
          return false;

        pDlgInfo->SetRadio(m_bIsRadio);

        /* Open dialog window */
        pDlgInfo->DoModal();

        return true;
      }
      else if (iControl == BUTTON_EDIT_CHANNEL)
      {
        CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
        if (!pItem)
          return false;

        if (pItem->GetPropertyBOOL("Virtual"))
        {
          CStdString strURL = pItem->GetProperty("StreamURL");
          if (CGUIDialogKeyboard::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
            pItem->SetProperty("StreamURL", strURL);
          return true;
        }

        CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
        return true;
      }
      else if (iControl == BUTTON_DELETE_CHANNEL)
      {
        CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
        if (!pItem)
          return false;

        // prompt user for confirmation of channel record
        CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
        if (!pDialog)
          return true;

        pDialog->SetHeading(19211);
        pDialog->SetLine(0, "");
        pDialog->SetLine(1, 750);
        pDialog->SetLine(2, "");
        pDialog->DoModal();

        if (pDialog->IsConfirmed())
        {
          if (pItem->GetPropertyBOOL("Virtual"))
          {
            CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
            database->Open();
            database->Delete(*pItem->GetPVRChannelInfoTag());
            database->Close();

            m_channelItems->Remove(m_iSelected);
            m_viewControl.SetItems(*m_channelItems);
            Renumber();
            return true;
          }
          CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
        }
        return true;
      }
      else if (iControl == BUTTON_NEW_CHANNEL)
      {
        std::vector<long> clients;

        CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
        if (!pDlgSelect)
          return false;

        pDlgSelect->SetHeading(19213); // Select Client
        pDlgSelect->Add(g_localizeStrings.Get(19209));
        clients.push_back(XBMC_VIRTUAL_CLIENTID);

        std::map<long, CStdString> clientMap;
        if (CPVRManager::GetClients()->GetClients(&clientMap) > 0)
        {
          std::map<long,CStdString>::iterator itr;
          for (itr = clientMap.begin() ; itr != clientMap.end(); itr++)
          {
            clients.push_back((*itr).first);
            pDlgSelect->Add(clientMap[(*itr).first]);
          }
        }
        pDlgSelect->DoModal();

        int selection = pDlgSelect->GetSelectedLabel();
        if (selection >= 0 && selection <= (int) clients.size())
        {
          int clientID = clients[selection];
          if (clientID == XBMC_VIRTUAL_CLIENTID)
          {
            CStdString strURL = "";
            if (CGUIDialogKeyboard::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
            {
              if (!strURL.IsEmpty())
              {
                CPVRChannel newchannel(m_bIsRadio);
                newchannel.SetChannelName(g_localizeStrings.Get(19204));
                newchannel.SetEPGEnabled(false);
                newchannel.SetVirtual(true);
                newchannel.SetStreamURL(strURL);
                newchannel.SetClientID(XBMC_VIRTUAL_CLIENTID);

                CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase();
                database->Open();
                database->Persist(newchannel);
                database->Close();
                CFileItemPtr channel(new CFileItem(newchannel));

                if (channel)
                {
                  channel->SetProperty("ActiveChannel", true);
                  channel->SetProperty("Name", g_localizeStrings.Get(19204));
                  channel->SetProperty("UseEPG", false);
                  channel->SetProperty("Icon", newchannel.IconPath());
                  channel->SetProperty("EPGSource", (int)0);
                  channel->SetProperty("ClientName", g_localizeStrings.Get(19209));

                  m_channelItems->AddFront(channel, m_iSelected);
                  m_viewControl.SetItems(*m_channelItems);
                  Renumber();
                }
              }
            }
          }
          else
          {
            CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
          }
        }
        return true;
      }
    }
    break;
  }

  return CGUIDialog::OnMessage(message);
}
예제 #25
0
void CGUIDialogPVRGuideSearch::Update()
{
  CGUIEditControl        *pEdit;
  CGUIRadioButtonControl *pRadioButton;

  if (!m_searchFilter)
    return;

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH);
  if (pEdit)
  {
    pEdit->SetLabel2(m_searchFilter->m_strSearchTerm);
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, 16017);
  }

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_CASE_SENS);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bIsCaseSensitive);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_INC_DESC);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bSearchInDescription);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_FTA_ONLY);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bFTAOnly);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_UNK_GENRE);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bIncludeUnknownGenres);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_REC);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bIgnorePresentRecordings);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_TMR);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bIgnorePresentTimers);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_SPIN_NO_REPEATS);
  if (pRadioButton) pRadioButton->SetSelected(m_searchFilter->m_bPreventRepeats);

  /* Set time fields */
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_TIME);
  if (pEdit)
  {
    pEdit->SetLabel2(m_searchFilter->m_endDateTime.GetAsLocalizedTime("", false));
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TIME, 14066);
  }
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_TIME);
  if (pEdit)
  {
    pEdit->SetLabel2(m_searchFilter->m_startDateTime.GetAsLocalizedTime("", false));
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TIME, 14066);
  }
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_DATE);
  if (pEdit)
  {
    pEdit->SetLabel2(m_searchFilter->m_startDateTime.GetAsDBDate());
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_DATE, 14067);
  }
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_DATE);
  if (pEdit)
  {
    pEdit->SetLabel2(m_searchFilter->m_endDateTime.GetAsDBDate());
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_DATE, 14067);
  }

  UpdateDurationSpin();
  UpdateGroupsSpin();
  UpdateChannelSpin();
  UpdateGenreSpin();
}
예제 #26
0
void CGUIDialogPVRGuideSearch::OnSearch()
{
  CStdString              strTmp;
  CGUISpinControlEx      *pSpin;
  CGUIEditControl        *pEdit;
  CGUIRadioButtonControl *pRadioButton;

  if (!m_searchFilter)
    return;

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH);
  if (pEdit) m_searchFilter->m_strSearchTerm = pEdit->GetLabel2();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_INC_DESC);
  if (pRadioButton) m_searchFilter->m_bSearchInDescription = pRadioButton->IsSelected();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_CASE_SENS);
  if (pRadioButton) m_searchFilter->m_bIsCaseSensitive = pRadioButton->IsSelected();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_FTA_ONLY);
  if (pRadioButton) m_searchFilter->m_bFTAOnly = pRadioButton->IsSelected();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_UNK_GENRE);
  if (pRadioButton) m_searchFilter->m_bIncludeUnknownGenres = pRadioButton->IsSelected();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_REC);
  if (pRadioButton) m_searchFilter->m_bIgnorePresentRecordings = pRadioButton->IsSelected();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_TMR);
  if (pRadioButton) m_searchFilter->m_bIgnorePresentTimers = pRadioButton->IsSelected();

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_SPIN_NO_REPEATS);
  if (pRadioButton) m_searchFilter->m_bPreventRepeats = pRadioButton->IsSelected();

  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GENRE);
  if (pSpin) m_searchFilter->m_iGenreType = pSpin->GetValue();

  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MIN_DURATION);
  if (pSpin) m_searchFilter->m_iMinimumDuration = pSpin->GetValue();

  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MAX_DURATION);
  if (pSpin) m_searchFilter->m_iMaximumDuration = pSpin->GetValue();

  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_CHANNELS);
  if (pSpin) m_searchFilter->m_iChannelNumber = pSpin->GetValue();

  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS);
  if (pSpin) m_searchFilter->m_iChannelGroup = pSpin->GetValue();

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_TIME);
  if (pEdit) strTmp = pEdit->GetLabel2();

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_DATE);
  if (pEdit) ReadDateTime(pEdit->GetLabel2(), strTmp, m_searchFilter->m_startDateTime);
  strTmp.clear();

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_TIME);
  if (pEdit) strTmp = pEdit->GetLabel2();

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_DATE);
  if (pEdit) ReadDateTime(pEdit->GetLabel2(), strTmp, m_searchFilter->m_endDateTime);
}
예제 #27
0
bool CGUIDialogBoxeeShare::OnMessage(CGUIMessage &message)
{
  if (message.GetMessage() == GUI_MSG_WINDOW_INIT)
  {
    //if (!LoadSocialServices(true))
    int retCode;
    if (BoxeeUtils::GetShareServicesJson(m_jsonServiceList,retCode,true) != JOB_SUCCEEDED)
    {
      Close();
      return true;
    }
  }
  else if (message.GetMessage() == GUI_MSG_WINDOW_DEINIT)
  {
    m_item.Reset();
  }
  else if (message.GetMessage() == GUI_MSG_CLICKED)
  {
    switch(message.GetSenderId())
    {
    case EDIT_CONTROL:
    {
      CGUIEditControl* editControl = (CGUIEditControl*)GetControl(EDIT_CONTROL);
      CGUIWindow* activeWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
      if (editControl && activeWindow)
      {
        CStdString leftToInput = BOXEE::BXUtils::IntToString(editControl->GetMaxInputSize() - (int)editControl->GetLabel2().size());
        activeWindow->SetProperty(LEFT_TO_INPUT_SIZE,leftToInput);
      }
    }
    break;
    case SHARE_BTN:
    {
      CGUIEditControl* editControl = (CGUIEditControl*)GetControl(EDIT_CONTROL);
      if (!editControl)
      {
        CGUIDialogOK2::ShowAndGetInput(257, 55195);
        return true;
      }

      m_strText = editControl->GetLabel2();

      if (m_strText.IsEmpty())
      {
        CGUIDialogOK2::ShowAndGetInput(54000, 54001);
        return true;
      }

      std::vector<BOXEE::BXFriend> recommendTo; // always empty at the moment - which means - "to all the world".

      BoxeeUtils::Share(&m_item, recommendTo, m_servicesList, false, m_strText);
      Close();
      g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::ICON_HEART, "", g_localizeStrings.Get(51033), 3000, KAI_RED_COLOR, KAI_GREY_COLOR);
    }
    break;
    case SERVICE_LIST:
    {
      CGUIBaseContainer* serviceList = (CGUIBaseContainer*) GetControl(SERVICE_LIST);
      CGUIListItemPtr itemUI = serviceList->GetSelectedItemPtr();

      int iItem = serviceList->GetSelectedItem();
      if (iItem < m_servicesList.Size() && iItem >= 0 )
      {
        CFileItemPtr fileItem = m_servicesList.Get(iItem);
        CFileItem* fItem = fileItem.get();

        //fItem->Dump();

        if (!fileItem->GetPropertyBOOL("enable"))
        {
          //open up the browser dialog with the link we got from the server
#ifdef CANMORE
          if (!g_application.IsPlaying() || g_application.GetCurrentPlayer() != PCID_FLASHLAYER)
          {
            //browser reported success
            int retCode;
            if (CGUIWebDialog::ShowAndGetInput(fileItem->GetProperty("connect")) && BoxeeUtils::GetShareServicesJson(m_jsonServiceList,retCode,true) == JOB_SUCCEEDED)
            {
              UpdateShareDialog();
            }
          }
          else
#endif
          {
            CStdString text = g_localizeStrings.Get(80001);
            text += " " + fileItem->GetProperty("link");
            CGUIDialogOK2::ShowAndGetInput(g_localizeStrings.Get(10014),text);
          }
          return true;
        }

        bool bSelection = itemUI->GetPropertyBOOL("isSelected");
        fItem->SetProperty("isSelected", !bSelection);
        itemUI->SetProperty("isSelected", !bSelection);
      }
    }
    break;
    }
	}

  return CGUIDialog::OnMessage(message);
}
예제 #28
0
void CGUIDialogPVRGuideSearch::Update()
{
  CGUISpinControlEx      *pSpin;
  CGUIEditControl        *pEdit;
  CGUIRadioButtonControl *pRadioButton;

  if (!m_searchfilter)
    return;

  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH);
  if (pEdit)
  {
    pEdit->SetLabel2(m_searchfilter->m_strSearchTerm);
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, 16017);
  }

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_CASE_SENS);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bIsCaseSensitive);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_INC_DESC);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bSearchInDescription);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_FTA_ONLY);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bFTAOnly);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_UNK_GENRE);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bIncludeUnknownGenres);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_REC);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bIgnorePresentRecordings);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_TMR);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bIgnorePresentTimers);

  pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_SPIN_NO_REPEATS);
  if (pRadioButton) pRadioButton->SetSelected(m_searchfilter->m_bPreventRepeats);

  /* Set duration list spin */
  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MIN_DURATION);
  if (pSpin)
  {
    pSpin->Clear();
    pSpin->AddLabel("-", -1);
    for (int i = 1; i < 12*60/5; i++)
    {
      CStdString string;
      string.Format(g_localizeStrings.Get(14044),i*5);
      pSpin->AddLabel(string, i*5);
    }
    pSpin->SetValue(m_searchfilter->m_iMinimumDuration);
  }

  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MAX_DURATION);
  if (pSpin)
  {
    pSpin->Clear();
    pSpin->AddLabel("-", -1);
    for (int i = 1; i < 12*60/5; i++)
    {
      CStdString string;
      string.Format(g_localizeStrings.Get(14044),i*5);
      pSpin->AddLabel(string, i*5);
    }
    pSpin->SetValue(m_searchfilter->m_iMaximumDuration);
  }

  /* Set time fields */
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_TIME);
  if (pEdit)
  {
    CDateTime time = m_searchfilter->m_startTime;
    pEdit->SetLabel2(time.GetAsLocalizedTime("", false));
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TIME, 14066);
  }
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_TIME);
  if (pEdit)
  {
    CDateTime time = m_searchfilter->m_endTime;
    pEdit->SetLabel2(time.GetAsLocalizedTime("", false));
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TIME, 14066);
  }
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_DATE);
  if (pEdit)
  {
    CDateTime date = m_searchfilter->m_startDate;
    pEdit->SetLabel2(date.GetAsDBDate());
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_DATE, 14067);
  }
  pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_DATE);
  if (pEdit)
  {
    CDateTime date = m_searchfilter->m_endDate;
    pEdit->SetLabel2(date.GetAsDBDate());
    pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_DATE, 14067);
  }

  /* Set Channel list spin */
  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_CHANNELS);
  if (pSpin)
  {
    CFileItemList channelslist_tv;
    const CPVRChannelGroup *group = CPVRManager::GetChannelGroups()->GetById(false, m_searchfilter->m_iChannelGroup);
    if (group)
      group->GetMembers(&channelslist_tv);

    pSpin->Clear();
    pSpin->AddLabel(g_localizeStrings.Get(19217), -1);
    pSpin->AddLabel(g_localizeStrings.Get(19023), -2);
    pSpin->AddLabel(g_localizeStrings.Get(19024), -3);

    for (int i = 0; i < channelslist_tv.Size(); i++)
    {
      int chanNumber = channelslist_tv[i]->GetPVRChannelInfoTag()->ChannelNumber();
      CStdString string;
      string.Format("%i %s", chanNumber, channelslist_tv[i]->GetPVRChannelInfoTag()->ChannelName().c_str());
      pSpin->AddLabel(string, chanNumber);
    }
    pSpin->SetValue(m_searchfilter->m_iChannelNumber);
  }

  /* Set Group list spin */
  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS);
  if (pSpin)
  {
    CFileItemList grouplist;
    CPVRManager::GetChannelGroups()->GetTV()->GetGroupList(&grouplist);

    pSpin->Clear();
    pSpin->AddLabel(g_localizeStrings.Get(593), -1);

    for (int i = 0; i < grouplist.Size(); i++)
      pSpin->AddLabel(grouplist[i]->GetLabel(), atoi(grouplist[i]->m_strPath));

    pSpin->SetValue(m_searchfilter->m_iChannelGroup);
  }

  /* Set Genre list spin */
  pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GENRE);
  if (pSpin)
  {
    pSpin->Clear();
    pSpin->AddLabel(g_localizeStrings.Get(593), -1);
    pSpin->AddLabel(g_localizeStrings.Get(19500), EVCONTENTMASK_MOVIEDRAMA);
    pSpin->AddLabel(g_localizeStrings.Get(19516), EVCONTENTMASK_NEWSCURRENTAFFAIRS);
    pSpin->AddLabel(g_localizeStrings.Get(19532), EVCONTENTMASK_SHOW);
    pSpin->AddLabel(g_localizeStrings.Get(19548), EVCONTENTMASK_SPORTS);
    pSpin->AddLabel(g_localizeStrings.Get(19564), EVCONTENTMASK_CHILDRENYOUTH);
    pSpin->AddLabel(g_localizeStrings.Get(19580), EVCONTENTMASK_MUSICBALLETDANCE);
    pSpin->AddLabel(g_localizeStrings.Get(19596), EVCONTENTMASK_ARTSCULTURE);
    pSpin->AddLabel(g_localizeStrings.Get(19612), EVCONTENTMASK_SOCIALPOLITICALECONOMICS);
    pSpin->AddLabel(g_localizeStrings.Get(19628), EVCONTENTMASK_EDUCATIONALSCIENCE);
    pSpin->AddLabel(g_localizeStrings.Get(19644), EVCONTENTMASK_LEISUREHOBBIES);
    pSpin->AddLabel(g_localizeStrings.Get(19660), EVCONTENTMASK_SPECIAL);
    pSpin->AddLabel(g_localizeStrings.Get(19499), EVCONTENTMASK_USERDEFINED);
    pSpin->SetValue(m_searchfilter->m_iGenreType);
  }
}