/lib/addons/library.xbmc.codec/Makefile
/lib/addons/library.xbmc.addon/project/VS2010Express/Release
/lib/addons/library.xbmc.addon/project/VS2010Express/Debug
+/lib/addons/library.xbmc.codec/project/VS2010Express/Release
+/lib/addons/library.xbmc.codec/project/VS2010Express/Debug
/lib/addons/library.xbmc.gui/project/VS2010Express/Release
/lib/addons/library.xbmc.gui/project/VS2010Express/Debug
/lib/addons/library.xbmc.pvr/project/VS2010Express/Release
/addons/library.xbmc.addon/libXBMC_addon.dll
/addons/library.xbmc.addon/libXBMC_addon.lib
+/addons/library.xbmc.codec/libXBMC_codec.dll
+/addons/library.xbmc.codec/libXBMC_codec.lib
/addons/library.xbmc.gui/libXBMC_gui.dll
/addons/library.xbmc.gui/libXBMC_gui.lib
/addons/library.xbmc.pvr/libXBMC_pvr.dll
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="xbmc.pvr" version="1.8.0" provider-name="Team XBMC">
+<addon id="xbmc.pvr" version="1.8.1" provider-name="Team XBMC">
<requires>
<import addon="xbmc.core" version="0.1.0"/>
</requires>
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
+#include "view/ViewStateSettings.h"
CGUIPassword::CGUIPassword(void)
{
return (iVerifyPasswordResult==0);
}
+bool CGUIPassword::CheckSettingLevelLock(const SettingLevel& level, bool enforce /*=false*/)
+{
+ LOCK_LEVEL::SETTINGS_LOCK lockLevel = CProfilesManager::Get().GetCurrentProfile().settingsLockLevel();
+
+ if (lockLevel == LOCK_LEVEL::NONE)
+ return true;
+
+ //check if we are already in settings and in an level that needs unlocking
+ int windowID = g_windowManager.GetActiveWindow();
+ if ((int)lockLevel-1 <= (short)CViewStateSettings::Get().GetSettingLevel() &&
+ (windowID == WINDOW_SETTINGS_MENU ||
+ (windowID >= WINDOW_SCREEN_CALIBRATION &&
+ windowID <= WINDOW_SETTINGS_MYPVR)))
+ return true; //Already unlocked
+
+ else if (lockLevel == LOCK_LEVEL::ALL)
+ return IsMasterLockUnlocked(true);
+ else if ((int)lockLevel-1 <= (short)level)
+ {
+ if (enforce)
+ return IsMasterLockUnlocked(true);
+ else if (!IsMasterLockUnlocked(false))
+ {
+ //Current Setting level is higher than our permission... so lower the viewing level
+ SettingLevel newLevel = (SettingLevel)(short)(lockLevel-2);
+ CViewStateSettings::Get().SetSettingLevel(newLevel);
+ }
+ }
+ return true;
+
+}
+
bool CGUIPassword::CheckMenuLock(int iWindowID)
{
bool bCheckPW = false;
switch (iSwitch)
{
case WINDOW_SETTINGS_MENU: // Settings
- bCheckPW = CProfilesManager::Get().GetCurrentProfile().settingsLocked();
+ return CheckSettingLevelLock(CViewStateSettings::Get().GetSettingLevel());
break;
case WINDOW_ADDON_BROWSER: // Addons
bCheckPW = CProfilesManager::Get().GetCurrentProfile().addonmanagerLocked();
#include "settings/ISettingCallback.h"
#include "utils/StdString.h"
+#include "settings/Setting.h"
class CFileItem;
class CMediaSource;
LOCK_MODE_EEPROM_PARENTAL = 5
} LockType;
+namespace LOCK_LEVEL {
+ /**
+ Specifies, what Settings levels are locked for the user
+ **/
+ enum SETTINGS_LOCK
+ {
+ NONE, //settings are unlocked => user can access all settings levels
+ ALL, //all settings are locked => user always has to enter password, when entering the settings screen
+ STANDARD, //settings level standard and up are locked => user can still access the beginner levels
+ ADVANCED,
+ EXPERT
+ };
+}
+
class CGUIPassword : public ISettingCallback
{
public:
void UpdateMasterLockRetryCount(bool bResetCount);
bool CheckStartUpLock();
+ /*! \brief Checks if the current profile is allowed to access the given settings level
+ \param level - The level to check
+ \param enforce - If false, CheckSettingLevelLock is allowed to lower the current settings level
+ to a level we're allowed to access
+ \returns true if we're allowed to access the settings
+ */
+ bool CheckSettingLevelLock(const SettingLevel& level, bool enforce = false);
bool CheckMenuLock(int iWindowID);
bool SetMasterLockMode(bool bDetails=true);
bool LockSource(const CStdString& strType, const CStdString& strName, bool bState);
files = false;
video = false;
music = false;
- settings = false;
+ settings = LOCK_LEVEL::NONE;
addonManager = false;
mode = type;
code = password;
XMLUtils::GetBoolean(node, "hassources", m_bSources);
XMLUtils::GetBoolean(node, "canwritesources", m_bCanWriteSources);
XMLUtils::GetBoolean(node, "lockaddonmanager", m_locks.addonManager);
- XMLUtils::GetBoolean(node, "locksettings", m_locks.settings);
+ XMLUtils::GetInt(node, "locksettings", (int&)m_locks.settings);
XMLUtils::GetBoolean(node, "lockfiles", m_locks.files);
XMLUtils::GetBoolean(node, "lockmusic", m_locks.music);
XMLUtils::GetBoolean(node, "lockvideo", m_locks.video);
XMLUtils::SetBoolean(node, "hassources", m_bSources);
XMLUtils::SetBoolean(node, "canwritesources", m_bCanWriteSources);
XMLUtils::SetBoolean(node, "lockaddonmanager", m_locks.addonManager);
- XMLUtils::SetBoolean(node, "locksettings", m_locks.settings);
+ XMLUtils::SetInt(node, "locksettings", m_locks.settings);
XMLUtils::SetBoolean(node, "lockfiles", m_locks.files);
XMLUtils::SetBoolean(node, "lockmusic", m_locks.music);
XMLUtils::SetBoolean(node, "lockvideo", m_locks.video);
LockType mode;
CStdString code;
bool addonManager;
- bool settings;
+ LOCK_LEVEL::SETTINGS_LOCK settings;
bool music;
bool video;
bool files;
bool hasSources() const { return m_bSources; }
bool canWriteSources() const { return m_bCanWriteSources; }
bool hasAddons() const { return m_bAddons; }
- bool settingsLocked() const { return m_locks.settings; }
+ /**
+ \brief Returns wich settings levels are locked for the current profile
+ \sa LOCK_LEVEL::SETTINGS_LOCK
+ */
+ LOCK_LEVEL::SETTINGS_LOCK settingsLockLevel() const { return m_locks.settings; }
bool addonmanagerLocked() const { return m_locks.addonManager; }
bool musicLocked() const { return m_locks.music; }
bool videoLocked() const { return m_locks.video; }
AddBool(5,20040,&m_locks.pictures);
AddBool(6,20041,&m_locks.programs);
AddBool(7,20042,&m_locks.files);
- AddBool(8,20043,&m_locks.settings);
+
+ std::vector<std::pair<int, int> > settingsLevelOptions;
+ settingsLevelOptions.push_back(std::make_pair(LOCK_LEVEL::NONE, 106));
+ settingsLevelOptions.push_back(std::make_pair(LOCK_LEVEL::ALL, 593));
+ settingsLevelOptions.push_back(std::make_pair(LOCK_LEVEL::STANDARD, 10037));
+ settingsLevelOptions.push_back(std::make_pair(LOCK_LEVEL::ADVANCED, 10038));
+ settingsLevelOptions.push_back(std::make_pair(LOCK_LEVEL::EXPERT, 10039));
+ AddSpin(8, 20043, (int*)&m_locks.settings, settingsLevelOptions);
+
AddBool(9,24090,&m_locks.addonManager);
EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
}
bool bLock = CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser;
dialog->m_locks.addonManager = bLock;
- dialog->m_locks.settings = bLock;
+ dialog->m_locks.settings = (bLock) ? LOCK_LEVEL::ALL : LOCK_LEVEL::NONE;
dialog->m_locks.files = bLock;
dialog->m_strDirectory.Empty();
bool ProfileHasSettingsLocked(const std::string &condition, const std::string &value, const std::string &settingId)
{
- return CProfilesManager::Get().GetCurrentProfile().settingsLocked();
+ LOCK_LEVEL::SETTINGS_LOCK slValue=LOCK_LEVEL::ALL;
+ if (StringUtils::EqualsNoCase(value, "none"))
+ slValue = LOCK_LEVEL::NONE;
+ else if (StringUtils::EqualsNoCase(value, "standard"))
+ slValue = LOCK_LEVEL::STANDARD;
+ else if (StringUtils::EqualsNoCase(value, "advanced"))
+ slValue = LOCK_LEVEL::ADVANCED;
+ else if (StringUtils::EqualsNoCase(value, "expert"))
+ slValue = LOCK_LEVEL::EXPERT;
+ return slValue <= CProfilesManager::Get().GetCurrentProfile().settingsLockLevel();
}
bool ProfileHasVideosLocked(const std::string &condition, const std::string &value, const std::string &settingId)
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "view/ViewStateSettings.h"
+#include "GUIPassword.h"
using namespace std;
case ACTION_SETTINGS_LEVEL_CHANGE:
{
+ //Test if we can access the new level
+ if (!g_passwordManager.CheckSettingLevelLock(CViewStateSettings::Get().GetNextSettingLevel(), true))
+ return false;
+
CViewStateSettings::Get().CycleSettingLevel();
CSettings::Get().Save();
// update the screen string
SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, section->GetLabel());
+
+ SET_CONTROL_LABEL(CONTRL_BTN_LEVELS, 10036 + (int)CViewStateSettings::Get().GetSettingLevel());
// get the categories we need
m_categories = section->GetCategories(CViewStateSettings::Get().GetSettingLevel());
}
else if (setting.id == AUDIO_SETTINGS_MAKE_DEFAULT)
{
- if (CProfilesManager::Get().GetCurrentProfile().settingsLocked() &&
- CProfilesManager::Get().GetMasterProfile().getLockMode() != ::LOCK_MODE_EVERYONE)
- if (!g_passwordManager.IsMasterLockUnlocked(true))
- return;
+ if (!g_passwordManager.CheckSettingLevelLock(SettingLevelExpert) &&
+ CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
+ return;
// prompt user if they are sure
if (CGUIDialogYesNo::ShowAndGetInput(12376, 750, 0, 12377))
if (setting.id == VIDEO_SETTINGS_CALIBRATION)
{
// launch calibration window
- if (CProfilesManager::Get().GetCurrentProfile().settingsLocked() && CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
- if (!g_passwordManager.IsMasterLockUnlocked(true))
- return;
+ if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
+ g_passwordManager.CheckSettingLevelLock(CSettings::Get().GetSetting("videoscreen.guicalibration")->GetLevel()))
+ return;
g_windowManager.ActivateWindow(WINDOW_SCREEN_CALIBRATION);
}
else if (setting.id == VIDEO_SETTINGS_MAKE_DEFAULT)
{
- if (CProfilesManager::Get().GetCurrentProfile().settingsLocked() && CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
- if (!g_passwordManager.IsMasterLockUnlocked(true))
- return;
+ if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
+ !g_passwordManager.CheckSettingLevelLock(::SettingLevelExpert))
+ return;
// prompt user if they are sure
if (CGUIDialogYesNo::ShowAndGetInput(12376, 750, 0, 12377))
void CViewStateSettings::CycleSettingLevel()
{
- m_settingLevel = (SettingLevel)((int)m_settingLevel + 1);
- if (m_settingLevel > SettingLevelExpert)
- m_settingLevel = SettingLevelBasic;
+ m_settingLevel = GetNextSettingLevel();
+}
+
+SettingLevel CViewStateSettings::GetNextSettingLevel() const
+{
+ SettingLevel level = (SettingLevel)((int)m_settingLevel + 1);
+ if (level > SettingLevelExpert)
+ level = SettingLevelBasic;
+ return level;
}
void CViewStateSettings::AddViewState(const std::string& strTagName, int defaultView /* = DEFAULT_VIEW_LIST */, SORT_METHOD defaultSort /* = SORT_METHOD_LABEL */)
SettingLevel GetSettingLevel() const { return m_settingLevel; }
void SetSettingLevel(SettingLevel settingLevel);
void CycleSettingLevel();
+ SettingLevel GetNextSettingLevel() const;
protected:
CViewStateSettings();