[mythtv] [PATCH] Small enhancements to VideoManager and EditMetaData within MythVideo

Andrew Retmanski aretmanski at msn.com
Tue Jul 27 19:21:22 EDT 2004


Hi,

This is my first ever patch, so go easy on me pls :-)

Two patches attached for MythVideo - the first allows both Info and Menu 
keys to act as "Info" within the VideoManager screen. I know this sort of 
breaks away from the new standard of "Menu" for screen wide stuff and "Info" 
for item specific actions, but the menu key isn't assigned to anything else 
within that screen at the moment and I keep pressing the wrong key!

Second patch is more useful, and fixes an annoyance for me within the 
EditMetaData screen with child video selection. I have a fairly large 
archive now of TV series which I prefer to watch individually. When I first 
enter the metadata dialog after adding new files I have to scroll through 
every video title in the "play this video next" edit until I get to "None".

So, I've added an additional check box next to the original child video 
selection edit, which can be unchecked to immediately set the next video to 
"None". Checking the box restores the previous value of the edit box (sadly 
I had to use a new global variable within editmetadata.h to implement this 
behaviour - hope that's ok?)

I'm quite chuffed with this patch - saves me a whole heap of time entering 
meta data for my videos.

Hope it's useful enough for others to get this committed.

Please let me know if I've stuffed up the patch submission process - I'm new 
to CVS too.

(Third attachment my.patch is combined version with both of these two 
patches, the other two patches have been hand edited from that patch - 
haven't figured out how to create a patch for a given file mask yet...)


Cheers,

Andrew.

-------------- next part --------------
Index: mythvideo/editmetadata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/editmetadata.cpp,v
retrieving revision 1.11
diff -u -r1.11 editmetadata.cpp
--- mythvideo/editmetadata.cpp	10 Apr 2004 19:04:23 -0000	1.11
+++ mythvideo/editmetadata.cpp	27 Jul 2004 22:49:26 -0000
@@ -146,12 +146,19 @@
         if(working_metadata->ChildID() > 0)
         {
             child_select->setToItem(working_metadata->ChildID());
+            cachedChildSelection = working_metadata->ChildID();
         }
         else
         {
             child_select->setToItem(possible_starting_point);
+            cachedChildSelection = possible_starting_point;
         }
     }
+    if(child_select && child_check)
+    {
+        child_check->setState(cachedChildSelection > 0);
+        child_select->allowFocus(cachedChildSelection > 0);
+    }
     if(browse_check)
     {
         browse_check->setState(working_metadata->Browse());
@@ -342,9 +349,32 @@
     working_metadata->setShowLevel(new_level);
}

+void EditMetadataDialog::toggleChild(bool yes_or_no)
+{
+    if(child_select)
+    {
+        if(yes_or_no)
+        {
+            child_select->setToItem(cachedChildSelection);
+            working_metadata->setChildID(cachedChildSelection);
+        }
+        else
+        {
+            child_select->setToItem(0);
+            working_metadata->setChildID(0);
+        }
+        child_select->allowFocus(yes_or_no);
+    }
+}
+
void EditMetadataDialog::setChild(int new_child)
{
     working_metadata->setChildID(new_child);
+    if(child_check)
+    {
+        child_check->setState(new_child > 0);
+        cachedChildSelection = new_child;
+    }
}

void EditMetadataDialog::toggleBrowse(bool yes_or_no)
@@ -439,7 +469,14 @@
         connect(level_select, SIGNAL(pushed(int)),
                 this, SLOT(setLevel(int)));
     }
-
+
+    child_check = getUICheckBoxType("child_check");
+    if(child_check)
+    {
+       connect(child_check, SIGNAL(pushed(bool)),
+               this, SLOT(toggleChild(bool)));
+    }
+
     child_select = getUISelectorType("child_select");
     if(child_select)
     {
Index: mythvideo/editmetadata.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/editmetadata.h,v
retrieving revision 1.2
diff -u -r1.2 editmetadata.h
--- mythvideo/editmetadata.h	2 Mar 2004 17:57:53 -0000	1.2
+++ mythvideo/editmetadata.h	27 Jul 2004 22:49:27 -0000
@@ -50,6 +50,7 @@
     void setCategory(int new_category);
     void setPlayer(QString new_player);
     void setLevel(int new_level);
+    void toggleChild(bool yes_or_no);
     void setChild(int new_child);
     void toggleBrowse(bool yes_or_no);
     void findCoverArt();
@@ -71,12 +72,14 @@

     UISelectorType	*category_select;
     UISelectorType      *level_select;
+    UICheckBoxType      *child_check;
     UISelectorType      *child_select;
     UICheckBoxType      *browse_check;
     UIPushButtonType    *coverart_button;
     UITextType          *coverart_text;
     UITextButtonType    *done_button;
-
+
+    int cachedChildSelection;
};


Index: mythvideo/video-ui.xml
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/video-ui.xml,v
retrieving revision 1.27
diff -u -r1.27 video-ui.xml
--- mythvideo/video-ui.xml	12 Jun 2004 17:35:13 -0000	1.27
+++ mythvideo/video-ui.xml	27 Jul 2004 22:49:30 -0000
@@ -1154,8 +1154,15 @@
                 <image function="pushed" 
filename="mv_leftright_pushed.png"></image>
             </selector>

+            <checkbox name="child_check" draworder="0">
+                <position>310,245</position>
+                <image function="checked" 
filename="mv_checked.png"></image>
+                <image function="unchecked" 
filename="mv_unchecked.png"></image>
+                <image function="checked_high" 
filename="mv_checked_high.png"></image>
+                <image function="unchecked_high" 
filename="mv_unchecked_high.png"></image>
+            </checkbox>
             <selector name="child_select" draworder="0">
-                <area>310,245,300,40</area>
+                <area>350,245,250,40</area>
                 <font>display</font>
                 <image function="on" 
filename="mv_leftright_on.png"></image>
                 <image function="off" 
filename="mv_leftright_off.png"></image>

-------------- next part --------------
Index: mythvideo/videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.35
diff -u -r1.35 videomanager.cpp
--- mythvideo/videomanager.cpp	25 Jul 2004 14:43:07 -0000	1.35
+++ mythvideo/videomanager.cpp	27 Jul 2004 22:49:36 -0000
@@ -163,7 +163,7 @@
             pageDown();
         else if (action == "ESCAPE")
             exitWin();
-        else if ((action == "INFO"))
+        else if (action == "INFO" || action == "MENU")
              videoMenu();
         else if (action == "FILTER" && (m_state == SHOWING_MAINWINDOW))
             slotDoFilter();

-------------- next part --------------
Index: mythvideo/editmetadata.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/editmetadata.cpp,v
retrieving revision 1.11
diff -u -r1.11 editmetadata.cpp
--- mythvideo/editmetadata.cpp	10 Apr 2004 19:04:23 -0000	1.11
+++ mythvideo/editmetadata.cpp	27 Jul 2004 22:49:26 -0000
@@ -146,12 +146,19 @@
         if(working_metadata->ChildID() > 0)
         {
             child_select->setToItem(working_metadata->ChildID());
+            cachedChildSelection = working_metadata->ChildID();
         }
         else
         {
             child_select->setToItem(possible_starting_point);
+            cachedChildSelection = possible_starting_point;
         }
     }
+    if(child_select && child_check)
+    {
+        child_check->setState(cachedChildSelection > 0);
+        child_select->allowFocus(cachedChildSelection > 0);
+    }
     if(browse_check)
     {
         browse_check->setState(working_metadata->Browse());
@@ -342,9 +349,32 @@
     working_metadata->setShowLevel(new_level);
}

+void EditMetadataDialog::toggleChild(bool yes_or_no)
+{
+    if(child_select)
+    {
+        if(yes_or_no)
+        {
+            child_select->setToItem(cachedChildSelection);
+            working_metadata->setChildID(cachedChildSelection);
+        }
+        else
+        {
+            child_select->setToItem(0);
+            working_metadata->setChildID(0);
+        }
+        child_select->allowFocus(yes_or_no);
+    }
+}
+
void EditMetadataDialog::setChild(int new_child)
{
     working_metadata->setChildID(new_child);
+    if(child_check)
+    {
+        child_check->setState(new_child > 0);
+        cachedChildSelection = new_child;
+    }
}

void EditMetadataDialog::toggleBrowse(bool yes_or_no)
@@ -439,7 +469,14 @@
         connect(level_select, SIGNAL(pushed(int)),
                 this, SLOT(setLevel(int)));
     }
-
+
+    child_check = getUICheckBoxType("child_check");
+    if(child_check)
+    {
+       connect(child_check, SIGNAL(pushed(bool)),
+               this, SLOT(toggleChild(bool)));
+    }
+
     child_select = getUISelectorType("child_select");
     if(child_select)
     {
Index: mythvideo/editmetadata.h
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/editmetadata.h,v
retrieving revision 1.2
diff -u -r1.2 editmetadata.h
--- mythvideo/editmetadata.h	2 Mar 2004 17:57:53 -0000	1.2
+++ mythvideo/editmetadata.h	27 Jul 2004 22:49:27 -0000
@@ -50,6 +50,7 @@
     void setCategory(int new_category);
     void setPlayer(QString new_player);
     void setLevel(int new_level);
+    void toggleChild(bool yes_or_no);
     void setChild(int new_child);
     void toggleBrowse(bool yes_or_no);
     void findCoverArt();
@@ -71,12 +72,14 @@

     UISelectorType	*category_select;
     UISelectorType      *level_select;
+    UICheckBoxType      *child_check;
     UISelectorType      *child_select;
     UICheckBoxType      *browse_check;
     UIPushButtonType    *coverart_button;
     UITextType          *coverart_text;
     UITextButtonType    *done_button;
-
+
+    int cachedChildSelection;
};


Index: mythvideo/video-ui.xml
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/video-ui.xml,v
retrieving revision 1.27
diff -u -r1.27 video-ui.xml
--- mythvideo/video-ui.xml	12 Jun 2004 17:35:13 -0000	1.27
+++ mythvideo/video-ui.xml	27 Jul 2004 22:49:30 -0000
@@ -1154,8 +1154,15 @@
                 <image function="pushed" 
filename="mv_leftright_pushed.png"></image>
             </selector>

+            <checkbox name="child_check" draworder="0">
+                <position>310,245</position>
+                <image function="checked" 
filename="mv_checked.png"></image>
+                <image function="unchecked" 
filename="mv_unchecked.png"></image>
+                <image function="checked_high" 
filename="mv_checked_high.png"></image>
+                <image function="unchecked_high" 
filename="mv_unchecked_high.png"></image>
+            </checkbox>
             <selector name="child_select" draworder="0">
-                <area>310,245,300,40</area>
+                <area>350,245,250,40</area>
                 <font>display</font>
                 <image function="on" 
filename="mv_leftright_on.png"></image>
                 <image function="off" 
filename="mv_leftright_off.png"></image>
Index: mythvideo/videomanager.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
retrieving revision 1.35
diff -u -r1.35 videomanager.cpp
--- mythvideo/videomanager.cpp	25 Jul 2004 14:43:07 -0000	1.35
+++ mythvideo/videomanager.cpp	27 Jul 2004 22:49:36 -0000
@@ -163,7 +163,7 @@
             pageDown();
         else if (action == "ESCAPE")
             exitWin();
-        else if ((action == "INFO"))
+        else if (action == "INFO" || action == "MENU")
              videoMenu();
         else if (action == "FILTER" && (m_state == SHOWING_MAINWINDOW))
             slotDoFilter();



More information about the mythtv-dev mailing list