changed: Removed superfluous LCD settings to LCD.xml, and changed the LCD type to...
authorjmarshallnz <jmarshallnz@svn>
Mon, 26 Oct 2009 01:32:30 +0000 (01:32 +0000)
committerjmarshallnz <jmarshallnz@svn>
Mon, 26 Oct 2009 01:32:30 +0000 (01:32 +0000)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@24021 568bbfeb-2a22-0410-94d2-cc84cf5bfa90

language/English/strings.xml
userdata/LCD.xml
xbmc/Application.cpp
xbmc/GUISettings.cpp
xbmc/GUIWindowSettingsCategory.cpp
xbmc/linux/XLCDproc.cpp
xbmc/utils/LCD.cpp
xbmc/utils/LCD.h

index 61488dd..2bee358 100644 (file)
 
   <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>
index f72fcae..036bd97 100644 (file)
@@ -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>
index 7b8f674..ea5d4b5 100644 (file)
@@ -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();
   }
index 7572b70..5a25d91 100644 (file)
@@ -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);
index 6bcb1d4..5cdeb0e 100644 (file)
@@ -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
index 027fcf0..aab5d45 100644 (file)
@@ -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
index 496ee61..4ebaafd 100644 (file)
@@ -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);
+}
index 329f22d..80e4425 100644 (file)
@@ -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;
 };