[mythtv] [PATCH] Some PIP options

Stefan Ernst ml at ernx.de
Sat Jun 26 08:34:48 EDT 2004


Hi!

This patch adds some options for the PIP window.
1) PIP starts with the same channel shown in the main window.
2) After closing PIP the main window is switched to the
    channel the PIP had shown.
3) Specifying size and position.

Stefan
-------------- next part --------------
Index: programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.179
diff -u -r1.179 globalsettings.cpp
--- programs/mythfrontend/globalsettings.cpp	25 Jun 2004 21:54:54 -0000	1.179
+++ programs/mythfrontend/globalsettings.cpp	26 Jun 2004 12:03:24 -0000
@@ -184,6 +184,30 @@
     };
 };
 
+class PIPOpenSameChannel: public CheckBoxSetting, public GlobalSetting {
+public:
+    PIPOpenSameChannel():
+        GlobalSetting("PIPOpenSameChannel") {
+        setLabel(QObject::tr("Open PIP window with main window channel"));
+        setValue(false);
+        setHelpText(QObject::tr("Immediately after opening the PIP "
+                    "window its channel is switched to the same you "
+                    "watch in the main window."));
+    };
+};
+
+class PIPSwitchWhenClose: public CheckBoxSetting, public GlobalSetting {
+public:
+    PIPSwitchWhenClose():
+        GlobalSetting("PIPSwitchWhenClose") {
+        setLabel(QObject::tr("Switch main window channel when PIP closes"));
+        setValue(false);
+        setHelpText(QObject::tr("Immediately after closing the PIP window "
+                    "the main window channel is switched to the one you "
+                    "watched in the PIP window."));
+    };
+};
+
 class PIPLocation: public ComboBoxSetting, public GlobalSetting {
 public:
     PIPLocation():
@@ -197,6 +221,52 @@
     };
 };
 
+class PIPSizeW: public SpinBoxSetting, public GlobalSetting {
+public:
+    PIPSizeW():
+        SpinBoxSetting(0, 400, 10, true),
+        GlobalSetting("PIPSizeW") {
+        setLabel(QObject::tr("PIP Window Size Width"));
+        setValue(160);
+        setHelpText(QObject::tr("Width of PIP window."));
+    };
+};
+
+class PIPSizeH: public SpinBoxSetting, public GlobalSetting {
+public:
+    PIPSizeH():
+        SpinBoxSetting(0, 300, 10, true),
+        GlobalSetting("PIPSizeH") {
+        setLabel(QObject::tr("PIP Window Size Height"));
+        setValue(120);
+        setHelpText(QObject::tr("Height of PIP window."));
+    };
+};
+
+class PIPOffX: public SpinBoxSetting, public GlobalSetting {
+public:
+    PIPOffX():
+        SpinBoxSetting(0, 100, 1),
+        GlobalSetting("PIPOffX") {
+        setLabel(QObject::tr("PIP Window Offset X"));
+        setValue(40);
+        setHelpText(QObject::tr("Horizontal position of PIP window. "
+                    "(relative to main window)"));
+    };
+};
+
+class PIPOffY: public SpinBoxSetting, public GlobalSetting {
+public:
+    PIPOffY():
+        SpinBoxSetting(0, 100, 1),
+        GlobalSetting("PIPOffY") {
+        setLabel(QObject::tr("PIP Window Offset Y"));
+        setValue(30);
+        setHelpText(QObject::tr("Vertical position of PIP window. "
+                    "(relative to main window)"));
+    };
+};
+
 class AllRecGroupPassword: public LineEditSetting, public BackendSetting {
 public:
     AllRecGroupPassword():
@@ -2417,7 +2487,6 @@
     general->addChild(new UseVideoTimebase());
     general->addChild(new DecodeExtraAudio());
     general->addChild(new AspectOverride());
-    general->addChild(new PIPLocation());
     addChild(general);
 
     VerticalConfigurationGroup* gen2 = new VerticalConfigurationGroup(false);
@@ -2496,6 +2565,17 @@
     osd->addChild(new DefaultCCMode());
     osd->addChild(new PersistentBrowseMode());
     addChild(osd);
+
+    VerticalConfigurationGroup* pip = new VerticalConfigurationGroup(false);
+    pip->setLabel(QObject::tr("PIP Video (Picture In Picture)"));
+    pip->addChild(new PIPOpenSameChannel());
+    pip->addChild(new PIPSwitchWhenClose());
+    pip->addChild(new PIPLocation());
+    pip->addChild(new PIPSizeW());
+    pip->addChild(new PIPSizeH());
+    pip->addChild(new PIPOffX());
+    pip->addChild(new PIPOffY());
+    addChild(pip);
 }
 
 GeneralSettings::GeneralSettings()
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.188
diff -u -r1.188 tv_play.cpp
--- libs/libmythtv/tv_play.cpp	25 Jun 2004 21:54:53 -0000	1.188
+++ libs/libmythtv/tv_play.cpp	26 Jun 2004 12:03:29 -0000
@@ -1747,13 +1747,28 @@
         while (!pipnvp->IsPlaying())
             usleep(50);
 
-        nvp->SetPipPlayer(pipnvp);        
+        nvp->SetPipPlayer(pipnvp);
+
+        if (gContext->GetNumSetting("PIPOpenSameChannel",0)) {
+            QString mainchannel = recorder->GetCurrentChannel();
+            ToggleActiveWindow();
+            ChangeChannelByString(mainchannel);
+            ToggleActiveWindow();
+	}
+
     }
     else
     {
         if (activenvp != nvp)
             ToggleActiveWindow();
 
+        if (gContext->GetNumSetting("PIPSwitchWhenClose",0)) {
+            QString mainchannel = recorder->GetCurrentChannel();
+            QString pipchannel = piprecorder->GetCurrentChannel();
+            if (mainchannel != pipchannel)
+                ChangeChannelByString(pipchannel);
+	}
+
         nvp->SetPipPlayer(NULL);
         while (!nvp->PipPlayerSet())
             usleep(50);
@@ -2412,7 +2427,7 @@
 {
     bool muted = false;
 
-    if (!channame_vector.empty() && channame_vector.back() == name)
+    if (!channame_vector.empty() && channame_vector.back() == name && activenvp == nvp)
         return;
 
     if (!activerecorder->CheckChannel(name))
Index: libs/libmythtv/videooutbase.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videooutbase.h,v
retrieving revision 1.35
diff -u -r1.35 videooutbase.h
--- libs/libmythtv/videooutbase.h	4 Jun 2004 02:28:51 -0000	1.35
+++ libs/libmythtv/videooutbase.h	26 Jun 2004 12:03:29 -0000
@@ -211,6 +211,8 @@
     int letterbox;
 
     int PIPLocation;
+    int PIPOffX;
+    int PIPOffY;
 
     int ZoomedIn;
     int ZoomedUp;
Index: libs/libmythtv/videooutbase.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videooutbase.cpp,v
retrieving revision 1.50
diff -u -r1.50 videooutbase.cpp
--- libs/libmythtv/videooutbase.cpp	30 Apr 2004 06:54:35 -0000	1.50
+++ libs/libmythtv/videooutbase.cpp	26 Jun 2004 12:03:31 -0000
@@ -91,8 +91,8 @@
     piph_in = piph_out = -1;
     pipw_in = pipw_out = -1;
 
-    desired_piph = 128;
-    desired_pipw = 160;
+    desired_piph = 0;
+    desired_pipw = 0;
 
     allowpreviewepg = true;
 
@@ -134,6 +134,12 @@
 
     PIPLocation = gContext->GetNumSetting("PIPLocation", 0);
 
+    PIPOffX = gContext->GetNumSetting("PIPOffX", 40);
+    PIPOffY = gContext->GetNumSetting("PIPOffY", 30);
+
+    desired_pipw = gContext->GetNumSetting("PIPSizeW", 160);
+    desired_piph = gContext->GetNumSetting("PIPSizeH", 120);
+
     if (VertScanMode == "underscan")
     {
         img_vscanf = 0 - img_vscanf;
@@ -858,20 +864,20 @@
     {
         default:
         case kPIPTopLeft:
-                xoff = 30;
-                yoff = 40;
+                xoff = PIPOffX;
+                yoff = PIPOffY;
                 break;
         case kPIPBottomLeft:
-                xoff = 30;
-                yoff = frame->height - piph - 40;
+                xoff = PIPOffX;
+                yoff = frame->height - piph - PIPOffY;
                 break;
         case kPIPTopRight:
-                xoff = frame->width - pipw - 30;
-                yoff = 40;
+                xoff = frame->width - pipw - PIPOffX;
+                yoff = PIPOffY;
                 break;
         case kPIPBottomRight:
-                xoff = frame->width - pipw - 30;
-                yoff = frame->height - piph - 40;
+                xoff = frame->width - pipw - PIPOffX;
+                yoff = frame->height - piph - PIPOffY;
                 break;
     }
 
Index: libs/libmythtv/videoout_ivtv.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videoout_ivtv.cpp,v
retrieving revision 1.34
diff -u -r1.34 videoout_ivtv.cpp
--- libs/libmythtv/videoout_ivtv.cpp	24 Jun 2004 20:40:58 -0000	1.34
+++ libs/libmythtv/videoout_ivtv.cpp	26 Jun 2004 12:03:31 -0000
@@ -359,20 +359,20 @@
     {
         default:
         case kPIPTopLeft:
-                xoff = 50;
-                yoff = 40;
+                xoff = PIPOffX;
+                yoff = PIPOffY;
                 break;
         case kPIPBottomLeft:
-                xoff = 50;
-                yoff = frame->height - piph - 40;
+                xoff = PIPOffX;
+                yoff = frame->height - piph - PIPOffY;
                 break;
         case kPIPTopRight:
-                xoff = frame->width - pipw - 50;
-                yoff = 40;
+                xoff = frame->width - pipw - PIPOffX;
+                yoff = PIPOffY;
                 break;
         case kPIPBottomRight:
-                xoff = frame->width - pipw - 50;
-                yoff = frame->height - piph - 40;
+                xoff = frame->width - pipw - PIPOffX;
+                yoff = frame->height - piph - PIPOffY;
                 break;
     }
 


More information about the mythtv-dev mailing list