Skip to content

Commit

Permalink
Merge pull request xbmc#25943 from ksooo/pvr-fix-custom-timer-setting…
Browse files Browse the repository at this point in the history
…s-order

[PVR] Timer settings dialog: Ensure that the order of timer custom se…
  • Loading branch information
ksooo authored Nov 8, 2024
2 parents f9ea21c + 7ba339a commit c185b01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions xbmc/pvr/settings/PVRCustomTimerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CPVRCustomTimerSettings::CPVRCustomTimerSettings(
}

const std::string settingId{StringUtils::Format("{}-{}", settingIdPrefix, idx)};
m_customSettingDefs.insert({settingId, settingDef});
m_customSettingDefs.emplace_back(std::make_pair(settingId, settingDef));
++idx;
}
}
Expand Down Expand Up @@ -247,7 +247,8 @@ bool CPVRCustomTimerSettings::IsSettingSupportedForTimerType(const std::string&
std::shared_ptr<const CPVRTimerSettingDefinition> CPVRCustomTimerSettings::GetSettingDefintion(
const std::string& settingId) const
{
const auto it{m_customSettingDefs.find(settingId)};
const auto it{std::find_if(m_customSettingDefs.cbegin(), m_customSettingDefs.cend(),
[&settingId](const auto& entry) { return entry.first == settingId; })};
if (it == m_customSettingDefs.cend())
return {};

Expand Down
10 changes: 5 additions & 5 deletions xbmc/pvr/settings/PVRCustomTimerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr/pvr_timers.h" // PVR_TIMER_STATE
#include "pvr/timers/PVRTimerInfoTag.h"

#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>

class CSetting;
Expand Down Expand Up @@ -67,11 +67,11 @@ class CPVRCustomTimerSettings
std::shared_ptr<const CPVRTimerSettingDefinition> GetSettingDefintion(
const std::string& settingId) const;

using CustomSettingDefinitionsMap =
std::map<std::string,
std::shared_ptr<const CPVRTimerSettingDefinition>>; // setting id, setting def
using CustomSettingDefinitionsVector = std::vector<
std::pair<std::string,
std::shared_ptr<const CPVRTimerSettingDefinition>>>; // setting id, setting def

CustomSettingDefinitionsMap m_customSettingDefs;
CustomSettingDefinitionsVector m_customSettingDefs;
CPVRTimerInfoTag::CustomPropsMap m_customProps;
};
} // namespace PVR

0 comments on commit c185b01

Please sign in to comment.