Skip to content
This repository
Browse code

fixed, update of rss feed URLS

  • Loading branch information...
commit 16d84ccdc6edd6c0f2c31ef849a3ca72313aadd7 1 parent a629a7e
authored June 25, 2013
8  xbmc/guilib/GUIControlFactory.cpp
@@ -1066,15 +1066,9 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
1066 1066
     control = new CGUIRSSControl(
1067 1067
       parentID, id, posX, posY, width, height,
1068 1068
       labelInfo, textColor3, headlineColor, strRSSTags);
1069  
-
1070 1069
     RssUrls::const_iterator iter = CRssManager::Get().GetUrls().find(iUrlSet);
1071 1070
     if (iter != CRssManager::Get().GetUrls().end())
1072  
-    {
1073  
-      ((CGUIRSSControl *)control)->SetUrls(iter->second.url,iter->second.rtl);
1074  
-      ((CGUIRSSControl *)control)->SetIntervals(iter->second.interval);
1075  
-    }
1076  
-    else
1077  
-      CLog::Log(LOGERROR,"invalid rss url set referenced in skin");
  1071
+      ((CGUIRSSControl *)control)->SetUrlSet(iUrlSet);
1078 1072
   }
1079 1073
   else if (type == CGUIControl::GUICONTROL_BUTTON)
1080 1074
   {
30  xbmc/guilib/GUIRSSControl.cpp
@@ -42,6 +42,7 @@ CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float po
42 42
   m_pReader = NULL;
43 43
   m_rtl = false;
44 44
   m_stopped = false;
  45
+  m_urlset = 1;
45 46
   ControlType = GUICONTROL_RSS;
46 47
 }
47 48
 
@@ -55,6 +56,7 @@ CGUIRSSControl::CGUIRSSControl(const CGUIRSSControl &from)
55 56
   m_pReader = NULL;
56 57
   m_rtl = from.m_rtl;
57 58
   m_stopped = from.m_stopped;
  59
+  m_urlset = 1;
58 60
   ControlType = GUICONTROL_RSS;
59 61
 }
60 62
 
@@ -66,16 +68,6 @@ CGUIRSSControl::~CGUIRSSControl(void)
66 68
   m_pReader = NULL;
67 69
 }
68 70
 
69  
-void CGUIRSSControl::SetUrls(const vector<string> &vecUrl, bool rtl)
70  
-{
71  
-  m_vecUrls = vecUrl;
72  
-  m_rtl = rtl;
73  
-  if (m_scrollInfo.pixelSpeed > 0 && rtl)
74  
-    m_scrollInfo.pixelSpeed *= -1;
75  
-  else if (m_scrollInfo.pixelSpeed < 0 && !rtl)
76  
-    m_scrollInfo.pixelSpeed *= -1;
77  
-}
78  
-
79 71
 void CGUIRSSControl::OnFocus()
80 72
 {
81 73
   m_stopped = true;
@@ -86,9 +78,9 @@ void CGUIRSSControl::OnUnFocus()
86 78
   m_stopped = false;
87 79
 }
88 80
 
89  
-void CGUIRSSControl::SetIntervals(const vector<int>& vecIntervals)
  81
+void CGUIRSSControl::SetUrlSet(const int urlset)
90 82
 {
91  
-  m_vecIntervals = vecIntervals;
  83
+  m_urlset = urlset;
92 84
 }
93 85
 
94 86
 bool CGUIRSSControl::UpdateColors()
@@ -118,6 +110,20 @@ void CGUIRSSControl::Render()
118 110
     // Create RSS background/worker thread if needed
119 111
     if (m_pReader == NULL)
120 112
     {
  113
+      RssUrls::const_iterator iter = CRssManager::Get().GetUrls().find(m_urlset);
  114
+      if (iter == CRssManager::Get().GetUrls().end())
  115
+      {
  116
+        CGUIControl::Render();
  117
+        return;
  118
+      }
  119
+      m_rtl = iter->second.rtl;
  120
+      m_vecUrls = iter->second.url;
  121
+      m_vecIntervals = iter->second.interval;
  122
+      if (m_scrollInfo.pixelSpeed > 0 && m_rtl)
  123
+        m_scrollInfo.pixelSpeed *= -1;
  124
+      else if (m_scrollInfo.pixelSpeed < 0 && !m_rtl)
  125
+        m_scrollInfo.pixelSpeed *= -1;
  126
+
121 127
       if (CRssManager::Get().GetReader(GetID(), GetParentID(), this, m_pReader))
122 128
         m_scrollInfo.characterPos = m_pReader->m_SavedScrollPos;
123 129
       else
6  xbmc/guilib/GUIRSSControl.h
@@ -56,12 +56,11 @@ class CGUIRSSControl : public CGUIControl, public IRssObserver
56 56
   virtual bool CanFocus() const { return true; };
57 57
   virtual CRect CalcRenderRegion() const;
58 58
 
59  
-  void SetIntervals(const std::vector<int>& vecIntervals);
60  
-  void SetUrls(const std::vector<std::string>& vecUrl, bool rtl);
61  
-
62 59
   virtual void OnFocus();
63 60
   virtual void OnUnFocus();
64 61
 
  62
+  void SetUrlSet(const int urlset);
  63
+
65 64
 protected:
66 65
   virtual bool UpdateColors();
67 66
 
@@ -81,5 +80,6 @@ class CGUIRSSControl : public CGUIControl, public IRssObserver
81 80
   bool m_rtl;
82 81
   CScrollInfo m_scrollInfo;
83 82
   bool m_stopped;
  83
+  int  m_urlset;
84 84
 };
85 85
 #endif

0 notes on commit 16d84cc

Please sign in to comment.
Something went wrong with that request. Please try again.