Skip to content

Commit

Permalink
CServiceBroker: return a pointer for CSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
lrusak committed Sep 6, 2018
1 parent 5f77b6d commit 1be0b76
Show file tree
Hide file tree
Showing 253 changed files with 1,116 additions and 1,095 deletions.
156 changes: 80 additions & 76 deletions xbmc/Application.cpp

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions xbmc/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CBookmark;
class IActionListener;
class CGUIComponent;
class CAppInboundProtocol;
class CSettings;

namespace ADDON
{
Expand Down Expand Up @@ -390,6 +391,7 @@ friend class CAppInboundProtocol;
*/
bool NotifyActionListeners(const CAction &action) const;

std::unique_ptr<CSettings> m_pSettings;
std::unique_ptr<CGUIComponent> m_pGUI;
std::unique_ptr<CWinSystemBase> m_pWinSystem;
std::unique_ptr<ActiveAE::CActiveAE> m_pActiveAE;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/AutoSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int CAutoSwitch::GetView(const CFileItemList &vecItems)
int iSortMethod = -1;
int iPercent = 0;
int iCurrentWindow = CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow();
bool bHideParentFolderItems = !CServiceBroker::GetSettings().GetBool(CSettings::SETTING_FILELISTS_SHOWPARENTDIRITEMS);
bool bHideParentFolderItems = !CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_FILELISTS_SHOWPARENTDIRITEMS);

switch (iCurrentWindow)
{
Expand Down
18 changes: 9 additions & 9 deletions xbmc/Autorun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void CAutorun::ExecuteAutorun(const std::string& path, bool bypassSettings, bool
#ifdef HAS_CDDA_RIPPER
const CProfilesManager &profileManager = CServiceBroker::GetProfileManager();

if (CServiceBroker::GetSettings().GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) == AUTOCD_RIP &&
if (CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) == AUTOCD_RIP &&
pInfo->IsAudio(1) && !profileManager.GetCurrentProfile().musicLocked())
{
CCDDARipper::GetInstance().RipCD();
Expand All @@ -93,7 +93,7 @@ void CAutorun::ExecuteAutorun(const std::string& path, bool bypassSettings, bool

bool CAutorun::PlayDisc(const std::string& path, bool bypassSettings, bool startFromBeginning)
{
if ( !bypassSettings && CServiceBroker::GetSettings().GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) != AUTOCD_PLAY && !CServiceBroker::GetSettings().GetBool(CSettings::SETTING_DVDS_AUTORUN))
if ( !bypassSettings && CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) != AUTOCD_PLAY && !CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_DVDS_AUTORUN))
return false;

int nSize = CServiceBroker::GetPlaylistPlayer().GetPlaylist( PLAYLIST_MUSIC ).size();
Expand Down Expand Up @@ -182,7 +182,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde

// Check if the current foldername indicates a DVD structure (name is "VIDEO_TS")
if (StringUtils::EqualsNoCase(name, "VIDEO_TS") && bAllowVideo
&& (bypassSettings || CServiceBroker::GetSettings().GetBool(CSettings::SETTING_DVDS_AUTORUN)))
&& (bypassSettings || CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_DVDS_AUTORUN)))
{
std::string path = URIUtils::AddFileToFolder(pItem->GetPath(), "VIDEO_TS.IFO");
if(!CFile::Exists(path))
Expand All @@ -206,7 +206,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde
// A BR should also include an "AACS" folder for encryption, Sony-BRs can also include update folders for PS3 (PS3_UPDATE / PS3_VPRM).
//! @todo for the time being, the DVD autorun settings are used to determine if the BR should be started automatically.
if (StringUtils::EqualsNoCase(name, "BDMV") && bAllowVideo
&& (bypassSettings || CServiceBroker::GetSettings().GetBool(CSettings::SETTING_DVDS_AUTORUN)))
&& (bypassSettings || CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_DVDS_AUTORUN)))
{
CFileItemPtr item(new CFileItem(URIUtils::AddFileToFolder(pItem->GetPath(), "index.bdmv"), false));
item->SetLabel(g_mediaManager.GetDiskLabel(strDrive));
Expand Down Expand Up @@ -247,7 +247,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde

// Standard Content HD DVD (few discs?)
if (StringUtils::EqualsNoCase(name, "HVDVD_TS") && bAllowVideo
&& (bypassSettings || CServiceBroker::GetSettings().GetBool(CSettings::SETTING_DVDS_AUTORUN)))
&& (bypassSettings || CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_DVDS_AUTORUN)))
{
if (hddvdname == "")
{
Expand Down Expand Up @@ -340,7 +340,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde

// If a file format was extracted we are sure this is a VCD. Autoplay if settings indicate we should.
if (!strExt.empty() && bAllowVideo
&& (bypassSettings || CServiceBroker::GetSettings().GetBool(CSettings::SETTING_DVDS_AUTORUN)))
&& (bypassSettings || CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_DVDS_AUTORUN)))
{
CFileItemList items;
CDirectory::GetDirectory(pItem->GetPath(), items, strExt, DIR_FLAG_DEFAULTS);
Expand Down Expand Up @@ -369,12 +369,12 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde
}

// check video first
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || CServiceBroker::GetSettings().GetBool(CSettings::SETTING_DVDS_AUTORUN)))
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_DVDS_AUTORUN)))
{
// stack video files
CFileItemList tempItems;
tempItems.Append(vecItems);
if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_MYVIDEOS_STACKVIDEOS))
if (CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_MYVIDEOS_STACKVIDEOS))
tempItems.Stack();
CFileItemList itemlist;

Expand Down Expand Up @@ -413,7 +413,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde
}
}
// then music
if (!bPlaying && (bypassSettings || CServiceBroker::GetSettings().GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) == AUTOCD_PLAY) && bAllowMusic)
if (!bPlaying && (bypassSettings || CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_AUDIOCDS_AUTOACTION) == AUTOCD_PLAY) && bAllowMusic)
{
for (int i = 0; i < vecItems.Size(); i++)
{
Expand Down
8 changes: 4 additions & 4 deletions xbmc/FileItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void CFileItem::FillMusicInfoTag(const CPVRChannelPtr& channel, const CPVREpgInf
musictag->SetGenre(tag->Genre());
musictag->SetDuration(tag->GetDuration());
}
else if (CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE))
else if (CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE))
{
musictag->SetTitle(g_localizeStrings.Get(19055)); // no information available
}
Expand Down Expand Up @@ -168,7 +168,7 @@ CFileItem::CFileItem(const CPVRChannelPtr& channel)
m_pvrChannelInfoTag = channel;
SetLabel(channel->ChannelName());
m_strLabel2 = epgNow ? epgNow->Title() :
CServiceBroker::GetSettings().GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ?
CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_EPG_HIDENOINFOAVAILABLE) ?
"" : g_localizeStrings.Get(19055); // no information available

if (!channel->IconPath().empty())
Expand Down Expand Up @@ -2844,7 +2844,7 @@ void CFileItemList::StackFiles()
// item->m_bIsFolder = true; // don't treat stacked files as folders
// the label may be in a different char set from the filename (eg over smb
// the label is converted from utf8, but the filename is not)
if (!CServiceBroker::GetSettings().GetBool(CSettings::SETTING_FILELISTS_SHOWEXTENSIONS))
if (!CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_FILELISTS_SHOWEXTENSIONS))
URIUtils::RemoveExtension(stackName);

item1->SetLabel(stackName);
Expand Down Expand Up @@ -2980,7 +2980,7 @@ std::string CFileItem::GetUserMusicThumb(bool alwaysCheckRemote /* = false */, b
}

// if a folder, check for folder.jpg
if (m_bIsFolder && !IsFileFolder() && (!IsRemote() || alwaysCheckRemote || CServiceBroker::GetSettings().GetBool(CSettings::SETTING_MUSICFILES_FINDREMOTETHUMBS)))
if (m_bIsFolder && !IsFileFolder() && (!IsRemote() || alwaysCheckRemote || CServiceBroker::GetSettings()->GetBool(CSettings::SETTING_MUSICFILES_FINDREMOTETHUMBS)))
{
std::vector<std::string> thumbs = StringUtils::Split(g_advancedSettings.m_musicThumbs, "|");
for (std::vector<std::string>::const_iterator i = thumbs.begin(); i != thumbs.end(); ++i)
Expand Down
14 changes: 7 additions & 7 deletions xbmc/GUIPassword.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const std::string &strType)
}
else
{
if (0 != CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES) && pItem->m_iBadPwdCount >= CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES))
if (0 != CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES) && pItem->m_iBadPwdCount >= CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES))
{ // user previously exhausted all retries, show access denied error
HELPERS::ShowOKDialogText(CVariant{12345}, CVariant{12346});
return false;
Expand Down Expand Up @@ -97,7 +97,7 @@ bool CGUIPassword::IsItemUnlocked(CFileItem* pItem, const std::string &strType)
case 1:
{
// password entry failed
if (0 != CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES))
if (0 != CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES))
pItem->m_iBadPwdCount++;
sprintf(buffer,"%i",pItem->m_iBadPwdCount);
CMediaSourceSettings::GetInstance().UpdateSource(strType, strLabel, "badpwdcount", buffer);
Expand All @@ -123,7 +123,7 @@ bool CGUIPassword::CheckStartUpLock()
std::string strHeader = g_localizeStrings.Get(20075);

if (iMasterLockRetriesLeft == -1)
iMasterLockRetriesLeft = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES);
iMasterLockRetriesLeft = CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES);

if (g_passwordManager.iMasterLockRetriesLeft == 0)
g_passwordManager.iMasterLockRetriesLeft = 1;
Expand Down Expand Up @@ -156,7 +156,7 @@ bool CGUIPassword::CheckStartUpLock()

if (iVerifyPasswordResult == 0)
{
g_passwordManager.iMasterLockRetriesLeft = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES);
g_passwordManager.iMasterLockRetriesLeft = CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES);
return true; // OK The MasterCode Accepted! XBMC Can Run!
}
else
Expand Down Expand Up @@ -241,7 +241,7 @@ bool CGUIPassword::IsMasterLockUnlocked(bool bPromptUser, bool& bCanceled)
bCanceled = false;

if (iMasterLockRetriesLeft == -1)
iMasterLockRetriesLeft = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES);
iMasterLockRetriesLeft = CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES);

const CProfilesManager &profileManager = CServiceBroker::GetProfileManager();

Expand Down Expand Up @@ -286,7 +286,7 @@ void CGUIPassword::UpdateMasterLockRetryCount(bool bResetCount)
if (!bResetCount)
{
// Bad mastercode entered
if (0 < CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES))
if (0 < CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES))
{
// We're keeping track of how many bad passwords are entered
if (1 < g_passwordManager.iMasterLockRetriesLeft)
Expand All @@ -311,7 +311,7 @@ void CGUIPassword::UpdateMasterLockRetryCount(bool bResetCount)
HELPERS::ShowOKDialogLines(CVariant{20075}, CVariant{12345}, CVariant{std::move(dlgLine1)}, CVariant{0});
}
else
g_passwordManager.iMasterLockRetriesLeft = CServiceBroker::GetSettings().GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES); // user entered correct mastercode, reset retries to max allowed
g_passwordManager.iMasterLockRetriesLeft = CServiceBroker::GetSettings()->GetInt(CSettings::SETTING_MASTERLOCK_MAXRETRIES); // user entered correct mastercode, reset retries to max allowed
}

bool CGUIPassword::CheckLock(LockType btnType, const std::string& strPassword, int iHeading)
Expand Down
Loading

0 comments on commit 1be0b76

Please sign in to comment.