예제 #1
0
bool CGUIDialogKaiToast::DoWork()
{
  CSingleLock lock(m_critical);

  if (!m_notifications.empty() &&
      CTimeUtils::GetFrameTime() - m_timer > m_toastMessageTime)
  {
    Notification toast = m_notifications.front();
    m_notifications.pop();
    lock.Leave();

    m_toastDisplayTime = toast.displayTime;
    m_toastMessageTime = toast.messageTime;

    CSingleLock lock2(g_graphicsContext);

    if(!Initialize())
      return false;

    SET_CONTROL_LABEL(POPUP_CAPTION_TEXT, toast.caption);

    SET_CONTROL_LABEL(POPUP_NOTIFICATION_BUTTON, toast.description);

    // set the appropriate icon
    {
      std::string strTypeImage = toast.imagefile;

      if (strTypeImage.empty())
      {
        if (toast.eType == Default)
          strTypeImage = m_defaultIcon;
        else
        {
          int imageControl = -1;
          if (toast.eType == Info)
            imageControl = POPUP_ICON_INFO;
          else if (toast.eType == Warning)
            imageControl = POPUP_ICON_WARNING;
          else if (toast.eType == Error)
            imageControl = POPUP_ICON_ERROR;

          CGUIMessage msg(GUI_MSG_GET_FILENAME, GetID(), imageControl);
          if (OnMessage(msg))
            strTypeImage = msg.GetLabel();
        }
      }

      SET_CONTROL_FILENAME(POPUP_ICON, strTypeImage);
    }

    //  Play the window specific init sound for each notification queued
    SetSound(toast.withSound);

    ResetTimer();
    return true;
  }

  return false;
}
예제 #2
0
void CGUIDialogProfileSettings::SetupView()
{
  CGUIDialogSettingsManualBase::SetupView();

  // set the heading
  SetHeading(!m_showDetails ? 20255 : 20067);

  // set the profile name and directory
  updateProfileName();
  updateProfileDirectory();

  // set the image
  SET_CONTROL_FILENAME(CONTROL_PROFILE_IMAGE, !m_thumb.empty() ? m_thumb : m_defaultImage);
}
예제 #3
0
bool CGUIDialogKaiToast::DoWork()
{
  CSingleLock lock(m_critical);

  if (!m_notifications.empty() &&
      CTimeUtils::GetFrameTime() - m_timer > m_toastMessageTime)
  {
    Notification toast = m_notifications.front();
    m_notifications.pop();
    lock.Leave();

    m_toastDisplayTime = toast.displayTime;
    m_toastMessageTime = toast.messageTime;

    CSingleLock lock2(g_graphicsContext);

    if(!Initialize())
      return false;

    SET_CONTROL_LABEL(POPUP_CAPTION_TEXT, toast.caption);

    SET_CONTROL_LABEL(POPUP_NOTIFICATION_BUTTON, toast.description);

    // set the appropriate icon
    {
      std::string icon = toast.imagefile;
      if (icon.empty())
      {
        if (toast.eType == Warning)
          icon = "DefaultIconWarning.png";
        else if (toast.eType == Error)
          icon = "DefaultIconError.png";
        else
          icon = "DefaultIconInfo.png";
      }
      SET_CONTROL_FILENAME(POPUP_ICON, icon);
    }

    //  Play the window specific init sound for each notification queued
    SetSound(toast.withSound);

    // Activate haptics for this notification
    CServiceBroker::GetPeripherals().OnUserNotification();

    ResetTimer();
    return true;
  }

  return false;
}
예제 #4
0
void CGUIDialogProfileSettings::OnSettingAction(const CSetting *setting)
{
  if (setting == NULL)
    return;

  CGUIDialogSettingsManualBase::OnSettingAction(setting);

  const std::string &settingId = setting->GetId();
  if (settingId == SETTING_PROFILE_IMAGE)
  {
    VECSOURCES shares;
    g_mediaManager.GetLocalDrives(shares);

    CFileItemList items;
    if (!m_thumb.empty())
    {
      CFileItemPtr item(new CFileItem("thumb://Current", false));
      item->SetArt("thumb", m_thumb);
      item->SetLabel(g_localizeStrings.Get(20016));
      items.Add(item);
    }

    CFileItemPtr item(new CFileItem("thumb://None", false));
    item->SetArt("thumb", m_defaultImage);
    item->SetLabel(g_localizeStrings.Get(20018));
    items.Add(item);

    std::string thumb;
    if (CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), thumb) &&
        !StringUtils::EqualsNoCase(thumb, "thumb://Current"))
    {
      m_needsSaving = true;
      m_thumb = StringUtils::EqualsNoCase(thumb, "thumb://None") ? "" : thumb;

      SET_CONTROL_FILENAME(CONTROL_PROFILE_IMAGE, !m_thumb.empty() ? m_thumb : m_defaultImage);
    }
  }
  else if (settingId == SETTING_PROFILE_DIRECTORY)
  {
    if (!GetProfilePath(m_directory, m_isDefault))
      return;

    m_needsSaving = true;
    updateProfileDirectory();
  }
  else if (settingId == SETTING_PROFILE_LOCKS)
  {
    if (m_showDetails)
    {
      if (CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE && !m_isDefault)
      {
        if (CGUIDialogYesNo::ShowAndGetInput(20066, 20118))
          g_passwordManager.SetMasterLockMode(false);
        if (CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE)
          return;
      }
      if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_isDefault ? 12360 : 20068,
              CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE || m_isDefault))
        m_needsSaving = true;
    }
    else
    {
      if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_isDefault ? 12360 : 20068, false, false))
        m_needsSaving = true;
    }
  }
}