예제 #1
0
void CGUIDialogAudioDSPManager::Update()
{
    CGUIDialogBusy* pDlgBusy = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
    if (!pDlgBusy)
    {
        helper_LogError(__FUNCTION__);
        return;
    }
    pDlgBusy->Open();

    Clear();

    AE_DSP_MODELIST modes;
    CActiveAEDSPDatabase db;
    if (!db.Open())
    {
        pDlgBusy->Close();
        CLog::Log(LOGERROR, "DSP Manager - %s - Could not open DSP database for update!", __FUNCTION__);
        return;
    }

    // construct a CFileItemList to pass 'em on to the list
    CFileItemList items;
    for (int i = 0; i < AE_DSP_MODE_TYPE_MAX; ++i)
    {
        int iModeType = dsp_mode_types[i].iModeType;

        modes.clear();
        db.GetModes(modes, iModeType);

        // No modes available, nothing to do.
        if (!modes.empty())
        {
            CFileItemPtr item(new CFileItem());
            item->SetLabel(g_localizeStrings.Get(dsp_mode_types[i].iName));
            item->SetLabel2(g_localizeStrings.Get(dsp_mode_types[i].iDescription));
            item->SetProperty("currentMode", dsp_mode_types[i].sModeType);
            items.Add(item);

            AE_DSP_MENUHOOK_CAT menuHook = helper_GetMenuHookCategory(iModeType);
            int continuesNo = 1;
            for (unsigned int iModePtr = 0; iModePtr < modes.size(); iModePtr++)
            {
                CFileItem *listItem = helper_CreateModeListItem(modes[iModePtr].first, menuHook, &continuesNo);
                if (listItem)
                {
                    CFileItemPtr pItem(listItem);

                    if (pItem->GetProperty("ActiveMode").asBoolean())
                    {
                        m_activeItems[iModeType]->Add(pItem);
                    }
                    else
                    {
                        m_availableItems[iModeType]->Add(pItem);
                    }
                }
                ProcessRenderLoop(false);
            }

            m_availableItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
            if (iModeType == AE_DSP_MODE_TYPE_MASTER_PROCESS)
            {
                m_activeItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
            }

        }
    }

    CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_LIST_MODE_SELECTION, 0, 0, &items);
    OnMessage(msg);

    db.Close();

    pDlgBusy->Close();
}
void CGUIDialogAudioDSPManager::Update()
{
  CGUIDialogBusy* pDlgBusy = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
  if (!pDlgBusy)
  {
    helper_LogError(__FUNCTION__);
    return;
  }
  pDlgBusy->Open();

  Clear();

  AE_DSP_MODELIST modes;
  CActiveAEDSPDatabase db;
  if (!db.Open())
  {
    pDlgBusy->Close();
    CLog::Log(LOGERROR, "DSP Manager - %s - Could not open DSP database for update!", __FUNCTION__);
    return;
  }

  for (int iModeType = 0; iModeType < AE_DSP_MODE_TYPE_MAX; iModeType++)
  {
    modes.clear();
    db.GetModes(modes, iModeType);

    // No modes available, nothing to do.
    if (!modes.empty())
    {
      AE_DSP_MENUHOOK_CAT menuHook = helper_GetMenuHookCategory(iModeType);
      int continuesNo = 1;
      for (unsigned int iModePtr = 0; iModePtr < modes.size(); iModePtr++)
      {
        CFileItem *listItem = helper_CreateModeListItem(modes[iModePtr].first, menuHook, &continuesNo);
        if (listItem)
        {
          CFileItemPtr pItem(listItem);

          if (pItem->GetProperty("ActiveMode").asBoolean())
          {
            m_activeItems[iModeType]->Add(pItem);
          }
          else
          {
            m_availableItems[iModeType]->Add(pItem);
          }
        }
        g_windowManager.ProcessRenderLoop(false);
      }

      m_availableItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
      if (iModeType == AE_DSP_MODE_TYPE_MASTER_PROCESS)
      {
        m_activeItems[iModeType]->Sort(SortByLabel, SortOrderAscending);
      }

    }
  }

  db.Close();

  pDlgBusy->Close();
}