diff options
-rw-r--r-- | language/English/strings.xml | 2 | ||||
-rw-r--r-- | userdata/LCD.xml | 2 | ||||
-rw-r--r-- | xbmc/Application.cpp | 19 | ||||
-rw-r--r-- | xbmc/GUISettings.cpp | 8 | ||||
-rw-r--r-- | xbmc/GUIWindowSettingsCategory.cpp | 53 | ||||
-rw-r--r-- | xbmc/linux/XLCDproc.cpp | 2 | ||||
-rw-r--r-- | xbmc/utils/LCD.cpp | 19 | ||||
-rw-r--r-- | xbmc/utils/LCD.h | 4 |
8 files changed, 35 insertions, 74 deletions
diff --git a/language/English/strings.xml b/language/English/strings.xml index 61488dd612..2bee358791 100644 --- a/language/English/strings.xml +++ b/language/English/strings.xml @@ -811,7 +811,7 @@ <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="10001">Programs</string> diff --git a/userdata/LCD.xml b/userdata/LCD.xml index f72fcae469..036bd97921 100644 --- a/userdata/LCD.xml +++ b/userdata/LCD.xml @@ -1,4 +1,6 @@ <lcd> + <!-- set this to video,music to disable the LCD on playback of music and video--> + <disableonplay>video</disableonplay> <navigation> <line>$INFO[System.CurrentWindow]</line> <line>$INFO[System.CurrentControl]</line> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 7b8f674838..ea5d4b5ee8 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -1605,17 +1605,13 @@ void CApplication::StopZeroconf() void CApplication::DimLCDOnPlayback(bool dim) { #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) - g_lcd->SetBackLight(0); - if ( (IsPlayingAudio()) && g_guiSettings.GetInt("lcd.disableonplayback") == LED_PLAYBACK_MUSIC) - g_lcd->SetBackLight(0); - if ( ((IsPlayingVideo() || IsPlayingAudio())) && g_guiSettings.GetInt("lcd.disableonplayback") == LED_PLAYBACK_VIDEO_MUSIC) - g_lcd->SetBackLight(0); + if (dim) + g_lcd->DisableOnPlayback(IsPlayingVideo(), IsPlayingAudio()); + else + g_lcd->SetBackLight(1); } - else if(!dim) - g_lcd->SetBackLight(1); #endif } @@ -2759,7 +2755,7 @@ void CApplication::UpdateLCD() #ifdef HAS_LCD static long lTickCount = 0; - if (!g_lcd || g_guiSettings.GetInt("lcd.type") == LCD_TYPE_NONE) + if (!g_lcd || !g_guiSettings.GetBool("system.haslcd")) return ; long lTimeOut = 1000; if ( m_iPlaySpeed != 1) @@ -4778,8 +4774,7 @@ void CApplication::ProcessSlow() if(IsPaused() != m_bIsPaused) { #ifdef HAS_LCD - if(g_guiSettings.GetBool("lcd.enableonpaused")) - DimLCDOnPlayback(m_bIsPaused); + DimLCDOnPlayback(m_bIsPaused); #endif m_bIsPaused = IsPaused(); } diff --git a/xbmc/GUISettings.cpp b/xbmc/GUISettings.cpp index 7572b70743..5a25d91637 100644 --- a/xbmc/GUISettings.cpp +++ b/xbmc/GUISettings.cpp @@ -334,13 +334,7 @@ void CGUISettings::Initialize() #if defined(_LINUX) && !defined(__APPLE__) AddInt(5, "system.powerbuttonaction", 13015, POWERSTATE_NONE, 0, 1, 5, SPIN_CONTROL_TEXT); #endif - -#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 + AddBool(6, "system.haslcd", 4501, false); #ifdef __APPLE__ AddCategory(4, "appleremote", 13600); diff --git a/xbmc/GUIWindowSettingsCategory.cpp b/xbmc/GUIWindowSettingsCategory.cpp index 6bcb1d4c38..5cdeb0e383 100644 --- a/xbmc/GUIWindowSettingsCategory.cpp +++ b/xbmc/GUIWindowSettingsCategory.cpp @@ -517,14 +517,6 @@ void CGUIWindowSettingsCategory::CreateSettings() pControl->AddLabel(g_localizeStrings.Get(603), CDDARIP_QUALITY_EXTREME); 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")) { CSettingInt *pSettingInt = (CSettingInt*)pSetting; @@ -802,28 +794,6 @@ void CGUIWindowSettingsCategory::CreateSettings() pControl->SetValue(pSettingInt->GetData()); } #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")) { CSettingInt *pSettingInt = (CSettingInt*)pSetting; @@ -1298,13 +1268,6 @@ void CGUIWindowSettingsCategory::UpdateSettings() else 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")) { if (m_strOldTrackFormat != g_guiSettings.GetString("musicfiles.trackformat")) @@ -1364,18 +1327,6 @@ void CGUIWindowSettingsCategory::UpdateSettings() if (pControl && g_guiSettings.GetString(strSetting, false).IsEmpty()) 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")) { } @@ -1827,14 +1778,12 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC } #endif #ifdef HAS_LCD - else if (strSetting.Equals("lcd.type")) + else if (strSetting.Equals("system.haslcd")) { -#ifdef _LINUX g_lcd->Stop(); CLCDFactory factory; delete g_lcd; g_lcd = factory.Create(); -#endif g_lcd->Initialize(); } #endif diff --git a/xbmc/linux/XLCDproc.cpp b/xbmc/linux/XLCDproc.cpp index 027fcf054d..aab5d451da 100644 --- a/xbmc/linux/XLCDproc.cpp +++ b/xbmc/linux/XLCDproc.cpp @@ -47,7 +47,7 @@ XLCDproc::~XLCDproc() void XLCDproc::Initialize() { - if (g_guiSettings.GetInt("lcd.type") == LCD_TYPE_NONE) + if (!g_guiSettings.GetBool("system.haslcd")) return ;//nothing to do // don't try to initialize too often diff --git a/xbmc/utils/LCD.cpp b/xbmc/utils/LCD.cpp index 496ee61aac..4ebaafd360 100644 --- a/xbmc/utils/LCD.cpp +++ b/xbmc/utils/LCD.cpp @@ -25,6 +25,7 @@ #include "Settings.h" #include "CharsetConverter.h" #include "log.h" +#include "XMLUtils.h" using namespace std; @@ -32,7 +33,7 @@ void ILCD::StringToLCDCharSet(CStdString& strText) { //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 //a block is used at address 0xA0, smallBlocks at address 0xAC-0xAF @@ -423,6 +424,14 @@ void ILCD::LoadSkin(const CStdString &xmlFile) 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(); while (mode) { @@ -469,6 +478,7 @@ void ILCD::LoadMode(TiXmlNode *node, LCD_MODE mode) void ILCD::Reset() { + m_disableOnPlay = DISABLE_ON_PLAY_NONE; for (unsigned int i = 0; i < LCD_MODE_MAX; i++) m_lcdMode[i].clear(); } @@ -491,3 +501,10 @@ void ILCD::Render(LCD_MODE mode) while (outLine < 4) 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); +} diff --git a/xbmc/utils/LCD.h b/xbmc/utils/LCD.h index 329f22d6f9..80e4425e75 100644 --- a/xbmc/utils/LCD.h +++ b/xbmc/utils/LCD.h @@ -56,6 +56,7 @@ public: virtual void SetBackLight(int iLight) = 0; virtual void SetContrast(int iContrast) = 0; virtual void SetLine(int iLine, const CStdString& strLine) = 0; + virtual void DisableOnPlayback(bool playingVideo, bool playingMusic); CStdString GetProgressBar(double tCurrent, double tTotal); void SetCharset( UINT nCharset ); CStdString GetBigDigit( UINT _nCharset, int _nDigit, UINT _nLine, UINT _nMinSize, UINT _nMaxSize, bool _bSpacePadding ); @@ -68,6 +69,9 @@ protected: unsigned char GetLCDCharsetCharacter( UINT _nCharacter, int _nCharset=-1); void LoadMode(TiXmlNode *node, LCD_MODE mode); 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]; UINT m_eCurrentCharset; }; |