Skip to content

Commit

Permalink
changed: Removed superfluous LCD settings to LCD.xml, and changed the…
Browse files Browse the repository at this point in the history
… LCD type to a simple toggle. Also removed unused LED settings.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@24021 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
jmarshallnz committed Oct 26, 2009
1 parent acaa497 commit 3e719a3
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 74 deletions.
2 changes: 1 addition & 1 deletion language/English/strings.xml
Expand Up @@ -811,7 +811,7 @@


<string id="2100">Script failed! : %s</string> <string id="2100">Script failed! : %s</string>


<string id="4501">LCD type</string> <string id="4501">Enable LCD</string>


<string id="10000">Home</string> <string id="10000">Home</string>
<string id="10001">Programs</string> <string id="10001">Programs</string>
Expand Down
2 changes: 2 additions & 0 deletions userdata/LCD.xml
@@ -1,4 +1,6 @@
<lcd> <lcd>
<!-- set this to video,music to disable the LCD on playback of music and video-->
<disableonplay>video</disableonplay>
<navigation> <navigation>
<line>$INFO[System.CurrentWindow]</line> <line>$INFO[System.CurrentWindow]</line>
<line>$INFO[System.CurrentControl]</line> <line>$INFO[System.CurrentControl]</line>
Expand Down
19 changes: 7 additions & 12 deletions xbmc/Application.cpp
Expand Up @@ -1605,17 +1605,13 @@ void CApplication::StopZeroconf()
void CApplication::DimLCDOnPlayback(bool dim) void CApplication::DimLCDOnPlayback(bool dim)
{ {
#ifdef HAS_LCD #ifdef HAS_LCD
if(g_lcd && dim && (g_guiSettings.GetInt("lcd.disableonplayback") != LED_PLAYBACK_OFF) && (g_guiSettings.GetInt("lcd.type") != LCD_TYPE_NONE)) if (g_lcd)
{ {
if ( (IsPlayingVideo()) && g_guiSettings.GetInt("lcd.disableonplayback") == LED_PLAYBACK_VIDEO) if (dim)
g_lcd->SetBackLight(0); g_lcd->DisableOnPlayback(IsPlayingVideo(), IsPlayingAudio());
if ( (IsPlayingAudio()) && g_guiSettings.GetInt("lcd.disableonplayback") == LED_PLAYBACK_MUSIC) else
g_lcd->SetBackLight(0); g_lcd->SetBackLight(1);
if ( ((IsPlayingVideo() || IsPlayingAudio())) && g_guiSettings.GetInt("lcd.disableonplayback") == LED_PLAYBACK_VIDEO_MUSIC)
g_lcd->SetBackLight(0);
} }
else if(!dim)
g_lcd->SetBackLight(1);
#endif #endif
} }


Expand Down Expand Up @@ -2759,7 +2755,7 @@ void CApplication::UpdateLCD()
#ifdef HAS_LCD #ifdef HAS_LCD
static long lTickCount = 0; static long lTickCount = 0;


if (!g_lcd || g_guiSettings.GetInt("lcd.type") == LCD_TYPE_NONE) if (!g_lcd || !g_guiSettings.GetBool("system.haslcd"))
return ; return ;
long lTimeOut = 1000; long lTimeOut = 1000;
if ( m_iPlaySpeed != 1) if ( m_iPlaySpeed != 1)
Expand Down Expand Up @@ -4778,8 +4774,7 @@ void CApplication::ProcessSlow()
if(IsPaused() != m_bIsPaused) if(IsPaused() != m_bIsPaused)
{ {
#ifdef HAS_LCD #ifdef HAS_LCD
if(g_guiSettings.GetBool("lcd.enableonpaused")) DimLCDOnPlayback(m_bIsPaused);
DimLCDOnPlayback(m_bIsPaused);
#endif #endif
m_bIsPaused = IsPaused(); m_bIsPaused = IsPaused();
} }
Expand Down
8 changes: 1 addition & 7 deletions xbmc/GUISettings.cpp
Expand Up @@ -334,13 +334,7 @@ void CGUISettings::Initialize()
#if defined(_LINUX) && !defined(__APPLE__) #if defined(_LINUX) && !defined(__APPLE__)
AddInt(5, "system.powerbuttonaction", 13015, POWERSTATE_NONE, 0, 1, 5, SPIN_CONTROL_TEXT); AddInt(5, "system.powerbuttonaction", 13015, POWERSTATE_NONE, 0, 1, 5, SPIN_CONTROL_TEXT);
#endif #endif

AddBool(6, "system.haslcd", 4501, false);
#ifdef HAS_LCD
AddCategory(4, "lcd", 448);
AddInt(2, "lcd.type", 4501, LCD_TYPE_NONE, LCD_TYPE_NONE, 1, LCD_TYPE_LCDPROC, SPIN_CONTROL_TEXT);
AddInt(7, "lcd.disableonplayback", 20310, LED_PLAYBACK_OFF, LED_PLAYBACK_OFF, 1, LED_PLAYBACK_VIDEO_MUSIC, SPIN_CONTROL_TEXT);
AddBool(8, "lcd.enableonpaused", 20312, true);
#endif


#ifdef __APPLE__ #ifdef __APPLE__
AddCategory(4, "appleremote", 13600); AddCategory(4, "appleremote", 13600);
Expand Down
53 changes: 1 addition & 52 deletions xbmc/GUIWindowSettingsCategory.cpp
Expand Up @@ -517,14 +517,6 @@ void CGUIWindowSettingsCategory::CreateSettings()
pControl->AddLabel(g_localizeStrings.Get(603), CDDARIP_QUALITY_EXTREME); pControl->AddLabel(g_localizeStrings.Get(603), CDDARIP_QUALITY_EXTREME);
pControl->SetValue(pSettingInt->GetData()); pControl->SetValue(pSettingInt->GetData());
} }
else if (strSetting.Equals("lcd.type"))
{
CSettingInt *pSettingInt = (CSettingInt*)pSetting;
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(strSetting)->GetID());
pControl->AddLabel(g_localizeStrings.Get(351), LCD_TYPE_NONE);
pControl->AddLabel("LCDproc", LCD_TYPE_LCDPROC);
pControl->SetValue(pSettingInt->GetData());
}
else if (strSetting.Equals("harddisk.aamlevel")) else if (strSetting.Equals("harddisk.aamlevel"))
{ {
CSettingInt *pSettingInt = (CSettingInt*)pSetting; CSettingInt *pSettingInt = (CSettingInt*)pSetting;
Expand Down Expand Up @@ -802,28 +794,6 @@ void CGUIWindowSettingsCategory::CreateSettings()
pControl->SetValue(pSettingInt->GetData()); pControl->SetValue(pSettingInt->GetData());
} }
#endif #endif
else if (strSetting.Equals("system.ledcolour"))
{
CSettingInt *pSettingInt = (CSettingInt*)pSetting;
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(strSetting)->GetID());
pControl->AddLabel(g_localizeStrings.Get(13340), LED_COLOUR_NO_CHANGE);
pControl->AddLabel(g_localizeStrings.Get(13341), LED_COLOUR_GREEN);
pControl->AddLabel(g_localizeStrings.Get(13342), LED_COLOUR_ORANGE);
pControl->AddLabel(g_localizeStrings.Get(13343), LED_COLOUR_RED);
pControl->AddLabel(g_localizeStrings.Get(13344), LED_COLOUR_CYCLE);
pControl->AddLabel(g_localizeStrings.Get(351), LED_COLOUR_OFF);
pControl->SetValue(pSettingInt->GetData());
}
else if (strSetting.Equals("system.leddisableonplayback") || strSetting.Equals("lcd.disableonplayback"))
{
CSettingInt *pSettingInt = (CSettingInt*)pSetting;
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(strSetting)->GetID());
pControl->AddLabel(g_localizeStrings.Get(106), LED_PLAYBACK_OFF); // No
pControl->AddLabel(g_localizeStrings.Get(13002), LED_PLAYBACK_VIDEO); // Video Only
pControl->AddLabel(g_localizeStrings.Get(475), LED_PLAYBACK_MUSIC); // Music Only
pControl->AddLabel(g_localizeStrings.Get(476), LED_PLAYBACK_VIDEO_MUSIC); // Video & Music
pControl->SetValue(pSettingInt->GetData());
}
else if (strSetting.Equals("videoplayer.rendermethod")) else if (strSetting.Equals("videoplayer.rendermethod"))
{ {
CSettingInt *pSettingInt = (CSettingInt*)pSetting; CSettingInt *pSettingInt = (CSettingInt*)pSetting;
Expand Down Expand Up @@ -1298,13 +1268,6 @@ void CGUIWindowSettingsCategory::UpdateSettings()
else else
g_guiSettings.SetString("weather.plugin", pControl->GetCurrentLabel()); g_guiSettings.SetString("weather.plugin", pControl->GetCurrentLabel());
} }
else if (strSetting.Equals("system.leddisableonplayback"))
{
CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID());
// LED_COLOUR_NO_CHANGE: we can't disable the LED on playback,
// we have no previos reference LED COLOUR, to set the LED colour back
pControl->SetEnabled(g_guiSettings.GetInt("system.ledcolour") != LED_COLOUR_NO_CHANGE && g_guiSettings.GetInt("system.ledcolour") != LED_COLOUR_OFF);
}
else if (strSetting.Equals("musicfiles.trackformat")) else if (strSetting.Equals("musicfiles.trackformat"))
{ {
if (m_strOldTrackFormat != g_guiSettings.GetString("musicfiles.trackformat")) if (m_strOldTrackFormat != g_guiSettings.GetString("musicfiles.trackformat"))
Expand Down Expand Up @@ -1364,18 +1327,6 @@ void CGUIWindowSettingsCategory::UpdateSettings()
if (pControl && g_guiSettings.GetString(strSetting, false).IsEmpty()) if (pControl && g_guiSettings.GetString(strSetting, false).IsEmpty())
pControl->SetLabel2(""); pControl->SetLabel2("");
} }
else if (strSetting.Equals("lcd.enableonpaused"))
{
CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("lcd.disableonplayback") != LED_PLAYBACK_OFF && g_guiSettings.GetInt("lcd.type") != LCD_TYPE_NONE);
}
else if (strSetting.Equals("system.ledenableonpaused"))
{
// LED_COLOUR_NO_CHANGE: we can't enable LED on paused,
// we have no previos reference LED COLOUR, to set the LED colour back
CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("system.leddisableonplayback") != LED_PLAYBACK_OFF && g_guiSettings.GetInt("system.ledcolour") != LED_COLOUR_OFF && g_guiSettings.GetInt("system.ledcolour") != LED_COLOUR_NO_CHANGE);
}
else if (strSetting.Equals("lookandfeel.enablemouse")) else if (strSetting.Equals("lookandfeel.enablemouse"))
{ {
} }
Expand Down Expand Up @@ -1827,14 +1778,12 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
} }
#endif #endif
#ifdef HAS_LCD #ifdef HAS_LCD
else if (strSetting.Equals("lcd.type")) else if (strSetting.Equals("system.haslcd"))
{ {
#ifdef _LINUX
g_lcd->Stop(); g_lcd->Stop();
CLCDFactory factory; CLCDFactory factory;
delete g_lcd; delete g_lcd;
g_lcd = factory.Create(); g_lcd = factory.Create();
#endif
g_lcd->Initialize(); g_lcd->Initialize();
} }
#endif #endif
Expand Down
2 changes: 1 addition & 1 deletion xbmc/linux/XLCDproc.cpp
Expand Up @@ -47,7 +47,7 @@ XLCDproc::~XLCDproc()


void XLCDproc::Initialize() void XLCDproc::Initialize()
{ {
if (g_guiSettings.GetInt("lcd.type") == LCD_TYPE_NONE) if (!g_guiSettings.GetBool("system.haslcd"))
return ;//nothing to do return ;//nothing to do


// don't try to initialize too often // don't try to initialize too often
Expand Down
19 changes: 18 additions & 1 deletion xbmc/utils/LCD.cpp
Expand Up @@ -25,14 +25,15 @@
#include "Settings.h" #include "Settings.h"
#include "CharsetConverter.h" #include "CharsetConverter.h"
#include "log.h" #include "log.h"
#include "XMLUtils.h"


using namespace std; using namespace std;


void ILCD::StringToLCDCharSet(CStdString& strText) void ILCD::StringToLCDCharSet(CStdString& strText)
{ {


//0 = HD44780, 1=KS0073 //0 = HD44780, 1=KS0073
unsigned int iLCDContr = g_guiSettings.GetInt("lcd.type") == LCD_TYPE_LCD_KS0073 ? 1 : 0; unsigned int iLCDContr = 0;
//the timeline is using blocks //the timeline is using blocks
//a block is used at address 0xA0, smallBlocks at address 0xAC-0xAF //a block is used at address 0xA0, smallBlocks at address 0xAC-0xAF


Expand Down Expand Up @@ -423,6 +424,14 @@ void ILCD::LoadSkin(const CStdString &xmlFile)
return; return;
} }


// load our settings
CStdString disableOnPlay;
XMLUtils::GetString(element, "disableonplay", disableOnPlay);
if (disableOnPlay.Find("video") != CStdString::npos)
m_disableOnPlay |= DISABLE_ON_PLAY_VIDEO;
if (disableOnPlay.Find("music") != CStdString::npos)
m_disableOnPlay |= DISABLE_ON_PLAY_MUSIC;

TiXmlElement *mode = element->FirstChildElement(); TiXmlElement *mode = element->FirstChildElement();
while (mode) while (mode)
{ {
Expand Down Expand Up @@ -469,6 +478,7 @@ void ILCD::LoadMode(TiXmlNode *node, LCD_MODE mode)


void ILCD::Reset() void ILCD::Reset()
{ {
m_disableOnPlay = DISABLE_ON_PLAY_NONE;
for (unsigned int i = 0; i < LCD_MODE_MAX; i++) for (unsigned int i = 0; i < LCD_MODE_MAX; i++)
m_lcdMode[i].clear(); m_lcdMode[i].clear();
} }
Expand All @@ -491,3 +501,10 @@ void ILCD::Render(LCD_MODE mode)
while (outLine < 4) while (outLine < 4)
SetLine(outLine++, ""); SetLine(outLine++, "");
} }

void ILCD::DisableOnPlayback(bool playingVideo, bool playingAudio)
{
if ((playingVideo && (m_disableOnPlay & DISABLE_ON_PLAY_VIDEO)) ||
(playingAudio && (m_disableOnPlay & DISABLE_ON_PLAY_MUSIC)))
SetBackLight(0);
}
4 changes: 4 additions & 0 deletions xbmc/utils/LCD.h
Expand Up @@ -56,6 +56,7 @@ class ILCD : public CThread
virtual void SetBackLight(int iLight) = 0; virtual void SetBackLight(int iLight) = 0;
virtual void SetContrast(int iContrast) = 0; virtual void SetContrast(int iContrast) = 0;
virtual void SetLine(int iLine, const CStdString& strLine) = 0; virtual void SetLine(int iLine, const CStdString& strLine) = 0;
virtual void DisableOnPlayback(bool playingVideo, bool playingMusic);
CStdString GetProgressBar(double tCurrent, double tTotal); CStdString GetProgressBar(double tCurrent, double tTotal);
void SetCharset( UINT nCharset ); void SetCharset( UINT nCharset );
CStdString GetBigDigit( UINT _nCharset, int _nDigit, UINT _nLine, UINT _nMinSize, UINT _nMaxSize, bool _bSpacePadding ); CStdString GetBigDigit( UINT _nCharset, int _nDigit, UINT _nLine, UINT _nMinSize, UINT _nMaxSize, bool _bSpacePadding );
Expand All @@ -68,6 +69,9 @@ class ILCD : public CThread
unsigned char GetLCDCharsetCharacter( UINT _nCharacter, int _nCharset=-1); unsigned char GetLCDCharsetCharacter( UINT _nCharacter, int _nCharset=-1);
void LoadMode(TiXmlNode *node, LCD_MODE mode); void LoadMode(TiXmlNode *node, LCD_MODE mode);
private: private:
enum DISABLE_ON_PLAY { DISABLE_ON_PLAY_NONE = 0, DISABLE_ON_PLAY_VIDEO = 1, DISABLE_ON_PLAY_MUSIC = 2 };
int m_disableOnPlay;

std::vector<CGUIInfoLabel> m_lcdMode[LCD_MODE_MAX]; std::vector<CGUIInfoLabel> m_lcdMode[LCD_MODE_MAX];
UINT m_eCurrentCharset; UINT m_eCurrentCharset;
}; };
Expand Down

0 comments on commit 3e719a3

Please sign in to comment.