From 9182c2064790a8247622117138809d38a6c71f40 Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Wed, 12 Aug 2009 02:30:54 +0000
Subject: LinHES-config mythinstall: offer modelines listed in the ModePool for
 initial resolution in the installer

---
 abs/core-testing/LinHES-config/PKGBUILD        |  2 +-
 abs/core-testing/LinHES-config/README          |  4 +-
 abs/core-testing/LinHES-config/startx          |  2 +-
 abs/core-testing/LinHES-config/xconfig.sh      |  2 +-
 abs/core-testing/mythinstall/PKGBUILD          | 14 +++----
 abs/core-testing/mythinstall/xorgsettings.cpp  |  9 ++--
 abs/core-testing/mythinstall/xorgsettings.h    | 58 +++++++++++++++++++++++---
 abs/core-testing/mythtv/stable/mythtv/PKGBUILD |  2 +-
 8 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 3dd79eb..c6d0754 100644
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=73
+pkgrel=77
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted 
diff --git a/abs/core-testing/LinHES-config/README b/abs/core-testing/LinHES-config/README
index a615389..c53a5f7 100644
--- a/abs/core-testing/LinHES-config/README
+++ b/abs/core-testing/LinHES-config/README
@@ -1,6 +1,6 @@
 Thanks for giving this Preview Release of LinHES a try!  
-While the core of LinHes is quite stable, we still need to 
-implement some features. At the moment, LinHES is compiled for i686.  If you have an i586 class system, LinHES won't work for you.  We do intend for LinHES to be full i586 compatible.  In addition, we still have to implement support for more remotes and blasters. The TV out of the PVR-350 isn't supported at this time.  
+While the core of LinHES is quite stable, we still need to 
+implement some features. At the moment, LinHES is compiled for i686.  If you have an i586 class system, LinHES won't work for you.  We do intend for LinHES to be fully i586 compatible.  In addition, we still have to implement support for more remotes and blasters. The TV out of the PVR-350 isn't supported at this time.  
 
 Support for LinHES can be obtained at:
 http://linhes.org
diff --git a/abs/core-testing/LinHES-config/startx b/abs/core-testing/LinHES-config/startx
index 0ffdf8c..75ba06a 100755
--- a/abs/core-testing/LinHES-config/startx
+++ b/abs/core-testing/LinHES-config/startx
@@ -15,7 +15,7 @@ if [ x$USEVNC = x1 ]
 then
 	$MV_ROOT/bin/xconfig.sh
 	cat /etc/X11/xorg.conf | sed -e 's/dev\/mouse/dev\/psaux/g'> /root/xorg.conf.install
-	startx /root/live-install.sh --  -config /root/xorg.conf.install -allowMouseOpenFail
+	startx /root/live-install.sh -- -logverbose 6 -config /root/xorg.conf.install -allowMouseOpenFail
  else
  #VNC
      pacman -Sf --noconfirm tightvnc
diff --git a/abs/core-testing/LinHES-config/xconfig.sh b/abs/core-testing/LinHES-config/xconfig.sh
index f90a60e..2fad821 100755
--- a/abs/core-testing/LinHES-config/xconfig.sh
+++ b/abs/core-testing/LinHES-config/xconfig.sh
@@ -66,7 +66,7 @@ function setupAdvancedX {
     Xcategory=`echo "$Xresadvanced" | cut -d_ -f1`
     Xres=`echo "$Xresadvanced" | cut -d_ -f2`
     echo "$Xcategory"
-    if [ "$Xcategory" = "Nvidia" ]
+    if [ "$Xcategory" = "nVidia Modeline" ]
     then
         Xres=""
         if [ "$XnVidia1080p" = "1" ]
diff --git a/abs/core-testing/mythinstall/PKGBUILD b/abs/core-testing/mythinstall/PKGBUILD
index f6fd685..81c6229 100644
--- a/abs/core-testing/mythinstall/PKGBUILD
+++ b/abs/core-testing/mythinstall/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Jams
 pkgname=mythinstall
 pkgver=1
-pkgrel=1
+pkgrel=3
 pkgdesc="LinHES installer/systemconfig GUI."
 arch=i686
 depends=()
@@ -37,12 +37,12 @@ build() {
 #   LinHES-PKGBUILD area.
 
     cd ${srcdir}
-    qmake mythinstall.pro
-    make
-    MVDIR=$startdir/pkg/usr/MythVantage
-    mkdir -p $MVDIR/bin
-    install -m 0755 mythinstall $MVDIR/bin/MythVantage
-    cd $MVDIR/bin
+    qmake mythinstall.pro || return 1
+    make || return 1
+    MVBINDIR=$startdir/pkg/usr/MythVantage/bin
+    mkdir -p $MVBINDIR
+    install -m 0755 mythinstall $MVBINDIR/MythVantage
+    cd $MVBINDIR
     ln -s MythVantage mythvantage
     ln -s MythVantage mythinstall
     cd -
diff --git a/abs/core-testing/mythinstall/xorgsettings.cpp b/abs/core-testing/mythinstall/xorgsettings.cpp
index 77fe023..02fa3ce 100755
--- a/abs/core-testing/mythinstall/xorgsettings.cpp
+++ b/abs/core-testing/mythinstall/xorgsettings.cpp
@@ -259,7 +259,7 @@ AdvancedXGeneric_modelines::AdvancedXGeneric_modelines():
     HostXModelineCatagory->addSelection("DVD");
     HostXModelineCatagory->addSelection("NTSC");
     HostXModelineCatagory->addSelection("Custom");
-    //HostXModelineCatagory->addSelection("Nvidia_modeline");
+    //HostXModelineCatagory->addSelection("nVidia Modeline");
     HostXModelineCatagory->setHelpText(QObject::tr(""));
 
     HostXadvancedresVESA = new HostComboBox("HostXadvancedresVESA");
@@ -427,7 +427,7 @@ AdvancedXNvidia_modelines::AdvancedXNvidia_modelines():
     HostXNvidiaModelineCatagory->addSelection("DVD");
     HostXNvidiaModelineCatagory->addSelection("NTSC");
     HostXNvidiaModelineCatagory->addSelection("Custom");
-    HostXNvidiaModelineCatagory->addSelection("Nvidia_modeline");
+    HostXNvidiaModelineCatagory->addSelection("nVidia Modeline");
     HostXNvidiaModelineCatagory->setHelpText(QObject::tr(""));
 
     HostXNvidiaadvancedresVESA = new HostComboBox("HostXNvidiaadvancedresVESA");
@@ -478,9 +478,8 @@ AdvancedXNvidia_modelines::AdvancedXNvidia_modelines():
     addTarget("DVD", HostXNvidiaadvancedresDVD);
     addTarget("NTSC", HostXNvidiaadvancedresNTSC);
     addTarget("Custom",HostXNvidiaadvancedresCustom);
-    addTarget("Nvidia_modeline",nVidiastandard);
+    addTarget("nVidia Modeline",nVidiastandard);
     addTarget("Auto", new VerticalConfigurationGroup(false, false));
-
 };
 
 
@@ -511,7 +510,7 @@ void AdvancedXNvidia_modelines::AdvancedXNvidia_modelines_GatherSettings(void)
                 modeline= HostXNvidiaadvancedresNTSC->getValue();
             else if ( modelinecatagory == "Custom")
                     modeline= HostXNvidiaadvancedresCustom->getValue();
-            else if ( modelinecatagory == "Nvidia_modeline" )
+            else if ( modelinecatagory == "nVidia Modeline" )
                     modeline = "Builtin" ;
             // need to add stuff to find the built in nvidia modelines
         hostparm.ThisXresadvanced = modelinecatagory +"_"+modeline;
diff --git a/abs/core-testing/mythinstall/xorgsettings.h b/abs/core-testing/mythinstall/xorgsettings.h
index 9efc669..c17720f 100755
--- a/abs/core-testing/mythinstall/xorgsettings.h
+++ b/abs/core-testing/mythinstall/xorgsettings.h
@@ -4,8 +4,6 @@
 #include "libmyth/mythwidgets.h"
 #include "installsettings.h"
 
-
-
 class AdvancedXNvidiaConnections: public TriggeredConfigurationGroup {
 Q_OBJECT
 public:
@@ -104,9 +102,59 @@ static HostComboBox *HostXres()
 {
     HostComboBox *gc = new HostComboBox("HostXres");
     gc->setLabel(QObject::tr("Initial resolution"));
-    gc->addSelection("800x600");
-    gc->addSelection("1280x720") ;
-    gc->addSelection("Auto") ;
+    const int num_defaults = 2;
+    char *defaults[num_defaults]={"800x600","1280x720"};
+    int defaults_added[num_defaults]={0,0};
+
+    gc->addSelection("Auto");
+
+    {
+      FILE *modelines;
+      const char*mode_extract_command =
+        "sed -n 's/[[:space:]]\\+/ /g;"             // compress whitespace
+                "s/[\\) ]: /#/g;"              // Insert # as a field delimiter
+		"/Modes in ModePool/,/ModePool/p'" // get the Modelool lines
+		" /var/log/Xorg.0.log |"             // from the Xorg log
+	"cut -d# -f2-3 | "            // select the mode and description fields
+	"sed '/^\\\"/!d;"             // Only selest modeline lines.
+	     "/DoubleScan/d;"         // Remove doublescan modelines.
+	     "/nvidia-auto-select/d;" // Remove auto modeline.
+             "s/ x /x/g;"
+	     "s/ @ /@/g;"
+             "s/From: //g;"
+             "s/ Format [0-9]*) (/, /g;"
+             "s/ Format [0-9]*//g;"
+	     "s/ Server//g'"; //reformat. 
+      cout << mode_extract_command << endl;
+      modelines = popen (mode_extract_command, "r");
+      if (modelines)
+      {
+	char line_in[200];
+	while (fgets (line_in, sizeof (line_in), modelines))
+	{
+          char *separator;
+
+	  if (strchr (line_in, '\n'))
+	    strchr (line_in, '\n')[0]=0;
+
+	  separator = strchr (line_in, '#');
+
+	  if (separator)
+	  {
+	    separator[0]=0;
+  	    gc->addSelection(separator + 1,line_in);
+ 	    for (int def = 0; def < num_defaults; def++)
+	      if (strncmp (&line_in[1], defaults[def], strlen (defaults[def]))==0)
+	        defaults_added[def]=1;
+	  }
+	}
+      }
+    }
+
+    for (int def = 0; def < num_defaults; def++)
+      if (!defaults_added[def])
+	gc->addSelection(defaults[def], defaults[def]);
+
     gc->setHelpText(QObject::tr(""));
     return gc;
 }
diff --git a/abs/core-testing/mythtv/stable/mythtv/PKGBUILD b/abs/core-testing/mythtv/stable/mythtv/PKGBUILD
index 3c11345..e33bb1f 100644
--- a/abs/core-testing/mythtv/stable/mythtv/PKGBUILD
+++ b/abs/core-testing/mythtv/stable/mythtv/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=mythtv
 pkgver=0.21
-pkgrel=79
+pkgrel=80
 pkgdesc="A Homebrew PVR project"
 arch=('i686' 'x86_64')
 depends=('bash' 'mysql-clients>=5.0' 'qt3' 'lame' 'lirc-utils' 'ffmpeg'
-- 
cgit v0.12

