fix
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 6 Jun 2006 17:05:55 +0000 (17:05 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 6 Jun 2006 17:05:55 +0000 (17:05 +0000)
lib/gui/esubtitle.cpp
lib/gui/esubtitle.h

index 933a6c6..167325d 100644 (file)
@@ -13,23 +13,19 @@ eSubtitleWidget::eSubtitleWidget(eWidget *parent)
        : eWidget(parent)
 {
        setBackgroundColor(gRGB(0,0,0,255));
        : eWidget(parent)
 {
        setBackgroundColor(gRGB(0,0,0,255));
+       m_page_ok = 0;
 }
 
 }
 
-void eSubtitleWidget::addPage(const eDVBTeletextSubtitlePage &p)
+void eSubtitleWidget::setPage(const eDVBTeletextSubtitlePage &p)
 {
 {
-       eDebug("ADD Subtitle Page!!");
-       m_pages.clear();
-       m_pages.push_back(p);
-       checkTiming();
-}
-
-void eSubtitleWidget::checkTiming()
-{
-       activatePage();
+       m_page = p;
+       m_page_ok = 1;
+       invalidate();
 }
 
 }
 
-void eSubtitleWidget::activatePage()
+void eSubtitleWidget::clearPage()
 {
 {
+       m_page_ok = 0;
        invalidate();
 }
 
        invalidate();
 }
 
@@ -48,21 +44,20 @@ int eSubtitleWidget::event(int event, void *data, void *data2)
                ePtr<gFont> font = new gFont("Regular", 30);
                painter.setFont(font);
                
                ePtr<gFont> font = new gFont("Regular", 30);
                painter.setFont(font);
                
-               std::list<eDVBTeletextSubtitlePage>::iterator pi = m_pages.begin();
-               if (pi == m_pages.end())
+               
+               if (!m_page_ok)
                        painter.renderText(eRect(ePoint(0, 0), size()), "waiting for subtitles...", gPainter::RT_WRAP);
                else
                {
                        painter.renderText(eRect(ePoint(0, 0), size()), "waiting for subtitles...", gPainter::RT_WRAP);
                else
                {
-                       const eDVBTeletextSubtitlePage &page = *pi;
-                       int elements = page.m_elements.size();
+                       int elements = m_page.m_elements.size();
                        int height = size().height();
                        int size_per_element = height / (elements ? elements : 1);
                        for (int i=0; i<elements; ++i)
                        {
                                painter.setForegroundColor(gRGB(0,0,0));
                        int height = size().height();
                        int size_per_element = height / (elements ? elements : 1);
                        for (int i=0; i<elements; ++i)
                        {
                                painter.setForegroundColor(gRGB(0,0,0));
-                               painter.renderText(eRect(2, size_per_element * i + 2, size().width(), size_per_element), page.m_elements[i].m_text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
-                               painter.setForegroundColor(page.m_elements[i].m_color);
-                               painter.renderText(eRect(0, size_per_element * i, size().width(), size_per_element), page.m_elements[i].m_text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
+                               painter.renderText(eRect(2, size_per_element * i + 2, size().width(), size_per_element), m_page.m_elements[i].m_text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
+                               painter.setForegroundColor(m_page.m_elements[i].m_color);
+                               painter.renderText(eRect(0, size_per_element * i, size().width(), size_per_element), m_page.m_elements[i].m_text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
                        }
                }
                return 0;
                        }
                }
                return 0;
index a4dab32..0cd66d2 100644 (file)
@@ -11,15 +11,15 @@ class eSubtitleWidget: public eWidget
 public:
        eSubtitleWidget(eWidget *parent);
        
 public:
        eSubtitleWidget(eWidget *parent);
        
-       void addPage(const eDVBTeletextSubtitlePage &p);
-       void checkTiming();
-       void activatePage();
-
+       void setPage(const eDVBTeletextSubtitlePage &p);
+       void clearPage();
+       
 protected:
        int event(int event, void *data=0, void *data2=0);
 
 private:
 protected:
        int event(int event, void *data=0, void *data2=0);
 
 private:
-       std::list<eDVBTeletextSubtitlePage> m_pages;
+       int m_page_ok;
+       eDVBTeletextSubtitlePage m_page;
 };
 
 #endif
 };
 
 #endif