/*
 *  Copyright (C) 2024 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "PlayerSettings.h"

#include "ServiceBroker.h"
#include "resources/LocalizeStrings.h"
#include "resources/ResourcesComponent.h"
#include "utils/StringUtils.h"

void CPlayerSettings::SettingOptionsQueueTimeSizesFiller(const SettingConstPtr& setting,
                                                         std::vector<IntegerSettingOption>& list,
                                                         int& current)
{
  const std::string& secFloat =
      CServiceBroker::GetResourcesComponent().GetLocalizeStrings().Get(13553);
  const std::string& seconds =
      CServiceBroker::GetResourcesComponent().GetLocalizeStrings().Get(37129);
  const std::string& second =
      CServiceBroker::GetResourcesComponent().GetLocalizeStrings().Get(37128);

  list.emplace_back(StringUtils::Format(secFloat, 0.5), 5);
  list.emplace_back(StringUtils::Format(second, 1), 10);
  list.emplace_back(StringUtils::Format(seconds, 2), 20);
  list.emplace_back(StringUtils::Format(seconds, 4), 40);
  list.emplace_back(StringUtils::Format(seconds, 8), 80);
  list.emplace_back(StringUtils::Format(seconds, 16), 160);
}

void CPlayerSettings::SettingOptionsQueueDataSizesFiller(const SettingConstPtr& /*setting*/,
                                                         std::vector<IntegerSettingOption>& list,
                                                         int& /*current*/)
{
  const std::string& mb = CServiceBroker::GetResourcesComponent().GetLocalizeStrings().Get(37122);
  const std::string& gb = CServiceBroker::GetResourcesComponent().GetLocalizeStrings().Get(37123);

  list.emplace_back(StringUtils::Format(mb, 16), 16);
  list.emplace_back(StringUtils::Format(mb, 32), 32);
  list.emplace_back(StringUtils::Format(mb, 64), 64);
  list.emplace_back(StringUtils::Format(mb, 128), 128);
  list.emplace_back(StringUtils::Format(mb, 256), 256);
  list.emplace_back(StringUtils::Format(mb, 512), 512);
  list.emplace_back(StringUtils::Format(gb, 1), 1024);
}

void CPlayerSettings::SettingOptionsFastForwardSpeeds(const SettingConstPtr& setting,
                                                      std::vector<IntegerSettingOption>& list,
                                                      int& current)
{
  const std::string& x = CServiceBroker::GetResourcesComponent().GetLocalizeStrings().Get(13559);

  list.emplace_back(StringUtils::Format(x, 2), 2);
  list.emplace_back(StringUtils::Format(x, 4), 4);
  list.emplace_back(StringUtils::Format(x, 8), 8);
  list.emplace_back(StringUtils::Format(x, 16), 16);
  list.emplace_back(StringUtils::Format(x, 32), 32);
}
