xbmc-pvr: update libcec patches

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-02-21 16:57:57 +01:00
parent a51344570a
commit dd88c4a5db
2 changed files with 2085 additions and 36 deletions

View File

@ -0,0 +1,168 @@
From b8ca2fd400720390d655a9d7d4c63b224c91d6e6 Mon Sep 17 00:00:00 2001
From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Thu, 26 Jan 2012 21:58:44 +0100
Subject: [PATCH] peripherals: call OnSettingChanged() methods after
persisting the new settings and always persist settings
directly after they've been changed in the gui. fixes the
issue that settings are reset when XBMC is restarted after
it crashed. closes trac 12570
---
xbmc/peripherals/devices/Peripheral.cpp | 33 +++++++++++--------
xbmc/peripherals/devices/Peripheral.h | 8 +---
.../dialogs/GUIDialogPeripheralSettings.cpp | 2 +
3 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/xbmc/peripherals/devices/Peripheral.cpp b/xbmc/peripherals/devices/Peripheral.cpp
index cc046dc..d07acaf 100644
--- a/xbmc/peripherals/devices/Peripheral.cpp
+++ b/xbmc/peripherals/devices/Peripheral.cpp
@@ -64,7 +64,7 @@
CPeripheral::~CPeripheral(void)
{
- PersistSettings();
+ PersistSettings(true);
for (unsigned int iSubdevicePtr = 0; iSubdevicePtr < m_subDevices.size(); iSubdevicePtr++)
delete m_subDevices.at(iSubdevicePtr);
@@ -323,7 +323,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, bool bValue)
bool bChanged(boolSetting->GetData() != bValue);
boolSetting->SetData(bValue);
if (bChanged && m_bInitialised)
- OnSettingChanged(strKey);
+ m_changedSettings.push_back(strKey);
}
}
}
@@ -339,7 +339,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, int iValue)
bool bChanged(intSetting->GetData() != iValue);
intSetting->SetData(iValue);
if (bChanged && m_bInitialised)
- OnSettingChanged(strKey);
+ m_changedSettings.push_back(strKey);
}
}
}
@@ -355,7 +355,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, float fValue)
bool bChanged(floatSetting->GetData() != fValue);
floatSetting->SetData(fValue);
if (bChanged && m_bInitialised)
- OnSettingChanged(strKey);
+ m_changedSettings.push_back(strKey);
}
}
}
@@ -373,7 +373,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, const CStdString &strValu
bool bChanged(!stringSetting->GetData().Equals(strValue));
stringSetting->SetData(strValue);
if (bChanged && m_bInitialised)
- OnSettingChanged(strKey);
+ m_changedSettings.push_back(strKey);
}
}
else if ((*it).second->GetType() == SETTINGS_TYPE_INT)
@@ -385,7 +385,7 @@ void CPeripheral::SetSetting(const CStdString &strKey, const CStdString &strValu
}
}
-void CPeripheral::PersistSettings(void) const
+void CPeripheral::PersistSettings(bool bExiting /* = false */)
{
TiXmlDocument doc;
TiXmlElement node("settings");
@@ -433,6 +433,13 @@ void CPeripheral::PersistSettings(void) const
}
doc.SaveFile(m_strSettingsFile);
+
+ if (!bExiting)
+ {
+ for (vector<CStdString>::iterator it = m_changedSettings.begin(); it != m_changedSettings.end(); it++)
+ OnSettingChanged(*it);
+ }
+ m_changedSettings.clear();
}
void CPeripheral::LoadPersistedSettings(void)
@@ -456,26 +463,24 @@ void CPeripheral::ResetDefaultSettings(void)
{
ClearSettings();
g_peripherals.GetSettingsFromMapping(*this);
- OnSettingsChanged();
-}
-void CPeripheral::ClearSettings(void)
-{
map<CStdString, CSetting *>::iterator it = m_settings.begin();
while (it != m_settings.end())
{
- delete (*it).second;
+ m_changedSettings.push_back((*it).first);
++it;
}
- m_settings.clear();
+
+ PersistSettings();
}
-void CPeripheral::OnSettingsChanged(void)
+void CPeripheral::ClearSettings(void)
{
map<CStdString, CSetting *>::iterator it = m_settings.begin();
while (it != m_settings.end())
{
- OnSettingChanged((*it).first);
+ delete (*it).second;
++it;
}
+ m_settings.clear();
}
diff --git a/xbmc/peripherals/devices/Peripheral.h b/xbmc/peripherals/devices/Peripheral.h
index e7860e4..7851554 100644
--- a/xbmc/peripherals/devices/Peripheral.h
+++ b/xbmc/peripherals/devices/Peripheral.h
@@ -87,11 +87,6 @@
virtual void OnSettingChanged(const CStdString &strChangedSetting) {};
/*!
- * @brief Called when one or more settings changed. Calls OnSettingChanged for every setting.
- */
- virtual void OnSettingsChanged(void);
-
- /*!
* @brief Get all subdevices if this device is multifunctional.
* @param subDevices The subdevices.
*/
@@ -143,7 +138,7 @@
virtual float GetSettingFloat(const CStdString &strKey) const;
virtual void SetSetting(const CStdString &strKey, float fValue);
- virtual void PersistSettings(void) const;
+ virtual void PersistSettings(bool bExiting = false);
virtual void LoadPersistedSettings(void);
virtual void ResetDefaultSettings(void);
@@ -168,5 +163,6 @@
std::vector<PeripheralFeature> m_features;
std::vector<CPeripheral *> m_subDevices;
std::map<CStdString, CSetting *> m_settings;
+ std::vector<CStdString> m_changedSettings;
};
}
diff --git a/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp b/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp
index f272d00..c79f961 100644
--- a/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp
+++ b/xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.cpp
@@ -176,6 +176,8 @@ void CGUIDialogPeripheralSettings::UpdatePeripheralSettings(void)
peripheral->SetSetting((*stringItr).first, (*stringItr).second);
++stringItr;
}
+
+ peripheral->PersistSettings();
}
bool CGUIDialogPeripheralSettings::OnMessage(CGUIMessage &message)
--
1.7.5.4