[mythtv] [Patch] mythvideo videobrowser

MaxPower maxpower44 at tiscali.fr
Tue Dec 16 08:35:35 EST 2003


An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20031216/ee74a5e5/attachment.html
-------------- next part --------------
--- /usr/local/src/cvs/myth/mythvideo/mythvideo/videobrowser.h	2003-09-02 22:09:53.000000000 +0200
+++ mythvideo/videobrowser.h	2003-12-16 14:05:15.000000000 +0100
@@ -81,6 +81,32 @@
     QRect fullRect;
 
     bool allowselect;
+	
+    // GUI
+    LayerSet	*background_layerset;
+    
+    LayerSet 	*browsing_layerset;
+    UITextType	*currentvideo_text;
+    UITextType	*parentallevel_text;
+
+    LayerSet	*info_layerset;
+    UITextType	*title_text;
+    UITextType  *filename_text;
+    UITextType	*director_text;
+    UITextType	*year_text;
+    UITextType	*coverfile_text;
+    UIImageType	*coverart_image;
+    UITextType	*inetref_text;
+    UITextType	*plot_text;
+    UITextType	*userrating_text;
+    UITextType  *rating_text;
+    UITextType  *length_text;
+    UITextType	*level_text;
+   
+    LayerSet	*playwait_layerset;
+    UITextType	*pw_title_text;
+
+    LayerSet	*novideo_layerset; 
 };
 
 #endif
-------------- next part --------------
--- /usr/local/src/cvs/myth/mythvideo/mythvideo/videobrowser.cpp	2003-12-07 18:00:02.000000000 +0100
+++ mythvideo/videobrowser.cpp	2003-12-16 14:26:11.000000000 +0100
@@ -45,7 +45,51 @@
     bgTransBackup = gContext->LoadScalePixmap("trans-backup.png");
     if (!bgTransBackup)
         bgTransBackup = new QPixmap();
+    background_layerset = theme->GetSet("background");
 
+    browsing_layerset = theme->GetSet("browsing");
+    if (browsing_layerset){
+	currentvideo_text = (UITextType*)browsing_layerset->GetType("currentvideo");
+	parentallevel_text = (UITextType*)browsing_layerset->GetType("pl_value");
+    }else{
+	currentvideo_text = NULL;
+	parentallevel_text = NULL;
+    }
+    info_layerset = theme->GetSet("info");
+    if(info_layerset){
+	title_text = (UITextType*)info_layerset->GetType("title");
+	filename_text = (UITextType*)info_layerset->GetType("filename");
+	director_text = (UITextType*)info_layerset->GetType("director");
+	year_text = (UITextType*)info_layerset->GetType("year");
+	coverfile_text = (UITextType*)info_layerset->GetType("coverfile");
+	coverart_image = (UIImageType*)info_layerset->GetType("coverart");
+	inetref_text = (UITextType*)info_layerset->GetType("inetref");
+	plot_text = (UITextType*)info_layerset->GetType("plot");
+	userrating_text = (UITextType*)info_layerset->GetType("userrating");
+	rating_text = (UITextType*)info_layerset->GetType("rating");
+	length_text = (UITextType*)info_layerset->GetType("length");
+	level_text = (UITextType*)info_layerset->GetType("level");
+    }else{
+	title_text=NULL;
+	filename_text=NULL;
+	director_text=NULL;
+	year_text=NULL;
+	coverfile_text=NULL;
+	coverart_image=NULL;
+	inetref_text=NULL;
+	plot_text=NULL;
+	userrating_text=NULL;
+	rating_text=NULL;
+	length_text=NULL;
+	level_text=NULL;
+    }
+    playwait_layerset = theme->GetSet("playwait");
+    if (playwait_layerset){
+    	pw_title_text = (UITextType *)playwait_layerset->GetType("title");
+    }else{
+	pw_title_text = NULL;
+    }
+    novideo_layerset = theme->GetSet("novideos_info");
     SetCurrentItem();
     updateBackground();
 
@@ -145,13 +189,11 @@
     if(checkParentPassword())
     {
         currentParentalLevel = which_level;
-        LayerSet *container = theme->GetSet("browsing");
-        if(container)
+        if(browsing_layerset)
         {
-            UITextType *pl_value = (UITextType *)container->GetType("pl_value");
-            if (pl_value)
+            if (parentallevel_text)
             {
-               pl_value->SetText(QString("%1").arg(currentParentalLevel));
+               parentallevel_text->SetText(QString("%1").arg(currentParentalLevel));
             }
         }
         RefreshMovieList();
@@ -204,9 +246,8 @@
 
     QPainter tmp(&bground);
 
-    LayerSet *container = theme->GetSet("background");
-    if (container)
-        container->Draw(&tmp, 0, 0);
+    if (background_layerset)
+        background_layerset->Draw(&tmp, 0, 0);
 
     tmp.end();
     myBackground = bground;
@@ -284,14 +325,12 @@
         grayOut(&backup);
     backup.end();
 
-    LayerSet *container = NULL;
-    container = theme->GetSet("playwait");
-    if (container)
-    {
-        container->Draw(p, 0, 0);
-        container->Draw(p, 1, 0);
-        container->Draw(p, 2, 0);
-        container->Draw(p, 3, 0);
+    if (playwait_layerset)
+    {
+        playwait_layerset->Draw(p, 0, 0);
+        playwait_layerset->Draw(p, 1, 0);
+        playwait_layerset->Draw(p, 2, 0);
+        playwait_layerset->Draw(p, 3, 0);
     }
     m_state++;
     update(fullRect);
@@ -399,28 +438,24 @@
         vidnum = tr("No Videos");
     }
 
-    LayerSet *container = NULL;
-    container = theme->GetSet("browsing");
-    if (container)
-    {
-        UITextType *type = (UITextType *)container->GetType("currentvideo");
-        if (type)
-            type->SetText(vidnum);
-
-        UITextType *pl_value = (UITextType *)container->GetType("pl_value");
-        if (pl_value)
-        {
-           pl_value->SetText(QString("%1").arg(currentParentalLevel));
-        }
-
-        container->Draw(&tmp, 1, 0);
-        container->Draw(&tmp, 2, 0);
-        container->Draw(&tmp, 3, 0);
-        container->Draw(&tmp, 4, 0);
-        container->Draw(&tmp, 5, 0);
-        container->Draw(&tmp, 6, 0);
-        container->Draw(&tmp, 7, 0);
-        container->Draw(&tmp, 8, 0);
+    if (browsing_layerset)
+    {
+        if (currentvideo_text)
+            currentvideo_text->SetText(vidnum);
+
+        if (parentallevel_text)
+        {
+           parentallevel_text->SetText(QString("%1").arg(currentParentalLevel));
+        }
+
+        browsing_layerset->Draw(&tmp, 1, 0);
+        browsing_layerset->Draw(&tmp, 2, 0);
+        browsing_layerset->Draw(&tmp, 3, 0);
+        browsing_layerset->Draw(&tmp, 4, 0);
+        browsing_layerset->Draw(&tmp, 5, 0);
+        browsing_layerset->Draw(&tmp, 6, 0);
+        browsing_layerset->Draw(&tmp, 7, 0);
+        browsing_layerset->Draw(&tmp, 8, 0);
     }
     tmp.end();
     p->drawPixmap(pr.topLeft(), pix);
@@ -451,84 +486,63 @@
        QString length = QString("%1").arg(curitem->Length()) + " " +
 	      	      	tr("minutes");
        QString level = QString("%1").arg(curitem->ShowLevel());
-
-       LayerSet *container = NULL;
-       container = theme->GetSet("info");
-       if (container)
+       if (info_layerset)
        {
-           UITextType *type = (UITextType *)container->GetType("title");
-           if (type)
-               type->SetText(title);
-
-           type = (UITextType *)container->GetType("filename");
-           if (type)
-               type->SetText(filename);
-
-           type = (UITextType *)container->GetType("director");
-           if (type)
-               type->SetText(director);
+           if (title_text)
+               title_text->SetText(title);
+           if (filename_text)
+               filename_text->SetText(filename);
+
+           if (director_text)
+               director_text->SetText(director);
  
-           type = (UITextType *)container->GetType("year");
-           if (type)
-               type->SetText(year);
-
-           type = (UITextType *)container->GetType("coverfile");
-           if (type)
-               type->SetText(coverfile);
-  
-           UIImageType *itype = (UIImageType *)container->GetType("coverart");
-           if (itype)
+           if (year_text)
+               year_text->SetText(year);
+
+           if (coverfile_text)
+               coverfile_text->SetText(coverfile);
+           if (coverart_image)
            {
-               itype->SetImage(coverfile);
-               itype->LoadImage();
+               coverart_image->SetImage(coverfile);
+               coverart_image->LoadImage();
            }
-
-           type = (UITextType *)container->GetType("inetref");
-           if (type)
-               type->SetText(inetref);
-
-           type = (UITextType *)container->GetType("plot");
-           if (type)
-               type->SetText(plot);
+           if (inetref_text)
+               inetref_text->SetText(inetref);
+           if (plot_text)
+               plot_text->SetText(plot);
  
-           type = (UITextType *)container->GetType("userrating");
-           if (type)
-               type->SetText(userrating);
-
-           type = (UITextType *)container->GetType("rating");
-           if (type)
-               type->SetText(rating);
-
-           type = (UITextType *)container->GetType("length");
-           if (type)
-               type->SetText(length);
-
-           type = (UITextType *)container->GetType("level");
-           if (type)
-               type->SetText(level);
-  
-           container->Draw(&tmp, 1, 0); 
-           container->Draw(&tmp, 2, 0);
-           container->Draw(&tmp, 3, 0);
-           container->Draw(&tmp, 4, 0);  
-           container->Draw(&tmp, 5, 0);
-           container->Draw(&tmp, 6, 0); 
-           container->Draw(&tmp, 7, 0);
-           container->Draw(&tmp, 8, 0);
+           if (userrating_text)
+               userrating_text->SetText(userrating);
+           if (rating_text)
+               rating_text->SetText(rating);
+
+           if (length_text)
+               length_text->SetText(length);
+
+           if (level_text)
+               level_text->SetText(level);
+           info_layerset->Draw(&tmp, 1, 0); 
+           info_layerset->Draw(&tmp, 2, 0);
+           info_layerset->Draw(&tmp, 3, 0);
+           info_layerset->Draw(&tmp, 4, 0);  
+           info_layerset->Draw(&tmp, 5, 0);
+           info_layerset->Draw(&tmp, 6, 0); 
+           info_layerset->Draw(&tmp, 7, 0);
+           info_layerset->Draw(&tmp, 8, 0);
        }
 
        allowselect = true;
     }
     else
     {
-       LayerSet *norec = theme->GetSet("novideos_info");
-       if (norec)
+       //LayerSet *norec = theme->GetSet("novideos_info");
+       if (novideo_layerset)
        {
-           norec->Draw(&tmp, 4, 0);
-           norec->Draw(&tmp, 5, 0);
-           norec->Draw(&tmp, 6, 0);
-           norec->Draw(&tmp, 7, 0);
-           norec->Draw(&tmp, 8, 0);
+           novideo_layerset->Draw(&tmp, 4, 0);
+           novideo_layerset->Draw(&tmp, 5, 0);
+           novideo_layerset->Draw(&tmp, 6, 0);
+           novideo_layerset->Draw(&tmp, 7, 0);
+           novideo_layerset->Draw(&tmp, 8, 0);
        }
 
        allowselect = false;
@@ -688,13 +702,10 @@
     //cout << "command:" << command << endl;
 
     m_title = someItem->Title();
-    LayerSet *container = NULL;
-    container = theme->GetSet("playwait");
-    if (container)
-    {
-         UITextType *type = (UITextType *)container->GetType("title");
-         if (type)
-             type->SetText(m_title);
+    if (playwait_layerset)
+    {
+         if (pw_title_text)
+             pw_title_text->SetText(m_title);
     }
     m_cmd = command;
     m_state = 1;


More information about the mythtv-dev mailing list