Skip to content

Commit

Permalink
add CSkinVariableString class
Browse files Browse the repository at this point in the history
it can't be instantiated yet - it will be done by CSkinVariable factory in next commits
  • Loading branch information
pieh committed Sep 29, 2011
1 parent 26446b1 commit 2741f73
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 0 deletions.
2 changes: 2 additions & 0 deletions project/VS2010Express/XBMC.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@
<ClCompile Include="..\..\xbmc\interfaces\http-api\HttpApi.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\http-api\XBMChttp.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\info\InfoBool.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\info\SkinVariable.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.cpp" />
<ClCompile Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.cpp" />
Expand Down Expand Up @@ -1387,6 +1388,7 @@
<ClInclude Include="..\..\xbmc\interfaces\http-api\XBMChttp.h" />
<ClInclude Include="..\..\xbmc\interfaces\IAnnouncer.h" />
<ClInclude Include="..\..\xbmc\interfaces\info\InfoBool.h" />
<ClInclude Include="..\..\xbmc\interfaces\info\SkinVariable.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\ApplicationOperations.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AudioLibrary.h" />
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\FileItemHandler.h" />
Expand Down
6 changes: 6 additions & 0 deletions project/VS2010Express/XBMC.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2502,6 +2502,9 @@
<ClCompile Include="..\..\xbmc\cores\paplayer\BXAcodec.cpp">
<Filter>cores\paplayer</Filter>
</ClCompile>
<ClCompile Include="..\..\xbmc\interfaces\info\SkinVariable.cpp">
<Filter>interfaces\info</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
Expand Down Expand Up @@ -5027,6 +5030,9 @@
<ClInclude Include="..\..\xbmc\cores\paplayer\BXAcodec.h">
<Filter>cores\paplayer</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\info\SkinVariable.h">
<Filter>interfaces\info</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
Expand Down
1 change: 1 addition & 0 deletions xbmc/interfaces/info/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SRCS=InfoBool.cpp \
SkinVariable.cpp \

LIB=info.a

Expand Down
52 changes: 52 additions & 0 deletions xbmc/interfaces/info/SkinVariable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2005-2011 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/

#include "SkinVariable.h"
#include "GUIInfoManager.h"

using namespace std;
using namespace INFO;

#define DEFAULT_VALUE -1

CSkinVariableString::CSkinVariableString()
{
}

const CStdString& CSkinVariableString::GetName() const
{
return m_name;
}

CStdString CSkinVariableString::GetValue(int contextWindow, bool preferImage /* = false*/, const CGUIListItem *item /* = NULL */)
{
for (VECCONDITIONLABELPAIR::const_iterator it = m_conditionLabelPairs.begin() ; it != m_conditionLabelPairs.end(); it++)
{
if (it->m_condition == DEFAULT_VALUE || g_infoManager.GetBoolValue(it->m_condition, item))
{
if (item)
return it->m_label.GetItemLabel(item, preferImage);
else
return it->m_label.GetLabel(contextWindow, preferImage);
}
}
return "";
}
47 changes: 47 additions & 0 deletions xbmc/interfaces/info/SkinVariable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once
/*
* Copyright (C) 2005-2011 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/

#include "guilib/GUIInfoTypes.h"

namespace INFO
{
class CSkinVariableString
{
public:
const CStdString& GetName() const;
CStdString GetValue(int contextWindow, bool preferImage = false, const CGUIListItem *item = NULL );
private:
CSkinVariableString();

CStdString m_name;

struct ConditionLabelPair
{
int m_condition;
CGUIInfoLabel m_label;
};

typedef std::vector<ConditionLabelPair> VECCONDITIONLABELPAIR;
VECCONDITIONLABELPAIR m_conditionLabelPairs;
};

}

0 comments on commit 2741f73

Please sign in to comment.