From a1e150195ed55ea1b9e6d2a8eded38072052ef6b Mon Sep 17 00:00:00 2001 From: Greg Frost Date: Sun, 28 Feb 2010 18:59:56 +1030 Subject: mythinstall: fix timezone crash, add folding@home, add xres from xorg.log --- abs/core-testing/mythinstall/PKGBUILD | 2 +- .../mythinstall/checkout_MythVantage.sh | 2 + .../mythinstall/xconfig_folding_timezone.patch | 454 +++++++++++++++++++++ 3 files changed, 457 insertions(+), 1 deletion(-) create mode 100644 abs/core-testing/mythinstall/xconfig_folding_timezone.patch diff --git a/abs/core-testing/mythinstall/PKGBUILD b/abs/core-testing/mythinstall/PKGBUILD index 74e0c5a..ccb07b3 100644 --- a/abs/core-testing/mythinstall/PKGBUILD +++ b/abs/core-testing/mythinstall/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Jams pkgname=mythinstall pkgver=2 -pkgrel=19 +pkgrel=20 pkgdesc="LinHES installer/systemconfig GUI." arch=i686 depends=() diff --git a/abs/core-testing/mythinstall/checkout_MythVantage.sh b/abs/core-testing/mythinstall/checkout_MythVantage.sh index 58849bf..c2c2f16 100755 --- a/abs/core-testing/mythinstall/checkout_MythVantage.sh +++ b/abs/core-testing/mythinstall/checkout_MythVantage.sh @@ -33,6 +33,8 @@ cd MythVantage-app git checkout master #git checkout origin/LinHES + patch -p 3 < ../../xconfig_folding_timezone.patch + } dl_repo diff --git a/abs/core-testing/mythinstall/xconfig_folding_timezone.patch b/abs/core-testing/mythinstall/xconfig_folding_timezone.patch new file mode 100644 index 0000000..d6215cd --- /dev/null +++ b/abs/core-testing/mythinstall/xconfig_folding_timezone.patch @@ -0,0 +1,454 @@ +diff -Naru mythinstall/src/MythVantage-app/mythinstall/installsettings.cpp mythinstall-tz/src/MythVantage-app/mythinstall/installsettings.cpp +--- mythinstall/src/MythVantage-app/mythinstall/installsettings.cpp 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/installsettings.cpp 2010-02-28 16:56:31.000000000 +1030 +@@ -45,6 +45,7 @@ + #include "mythdbparams.h" + + ++int timezone_unknown = FALSE; + extern HostParms hostparm; + extern DDCinfo ddcinfo; + +@@ -1288,6 +1289,62 @@ + return gc; + }; + ++static HostCheckBox *Hostfoldingathome() ++{ ++ HostCheckBox *gc = new HostCheckBox("Hostfoldingathome"); ++ gc->setLabel(QObject::tr("Folding@home")); ++ gc->setValue(false); ++ gc->setHelpText(QObject::tr("A distributed computing project which studies protein folding, misfolding, aggregation, and related diseases.")); ++ return gc; ++}; ++ ++static HostComboBox *Hostfoldingusername() ++{ ++ // If there is an old R5.5 style folding directory /myth/folding@home, attempt ++ // to retrieve the old username. ++ ++ FILE *username_pipe; ++ username_pipe = ++ popen ( ++ "grep username= /myth/folding@home/client.cfg 2> /dev/null | " ++ "sed 's/username=//g'", "r"); ++ ++ if (username_pipe) ++ { ++ char username[200]; ++ if (fgets (username, sizeof (username), username_pipe)) ++ { ++ char *new_line; ++ username[sizeof(username)-1]=0; ++ if ((new_line = strchr (username, '\n'))) ++ new_line[0] = 0; ++ ++ cout << "found old username " << username << endl; ++ ++ gContext->SetSetting("Hostfoldingusername", username); ++ gContext->SaveSetting("Hostfoldingusername", username); ++ } ++ pclose (username_pipe); ++ } ++ ++ HostComboBox *gc = new HostComboBox("Hostfoldingusername",true); ++ gc->setLabel(QObject::tr("Folding Username")); ++ gc->setValue(""); ++ ++ gc->setHelpText(QObject::tr("The username associated to the work-units you return.")); ++ return gc; ++}; ++ ++static HostComboBox *Hostfoldingworksize() ++{ ++ HostComboBox *gc = new HostComboBox("Hostfoldingworksize"); ++ gc->setLabel(QObject::tr("Work Packet Size")); ++ gc->addSelection("Big", "big"); ++ gc->addSelection("Normal", "normal"); ++ gc->addSelection("Small", "small"); ++ gc->setHelpText(QObject::tr("Acceptable size of work assignment and work result packets (bigger units may have large memory demands).")); ++ return gc; ++}; + + static HostCheckBox *HostXscreensaver() + { +@@ -3534,8 +3591,15 @@ + hostparm.ThisHostName = "You_Fool"; + } + // piece togther the timezone ++ QString tz; + QString tregion; + QString tsubregion; ++ ++ tz=gContext->GetSetting("HostTimeZone"); ++ ++ if ( tz.isEmpty() || (tz == "Unknown")) ++ timezone_unknown = TRUE; ++ + tregion=gContext->GetSetting("HostTimeZoneRegion"); + tsubregion=gContext->GetSetting("HostTimeZoneRegion_"+tregion); + if ( tsubregion.isEmpty() ) +@@ -4009,6 +4073,9 @@ + hostparm.ThisHostXine = gContext->GetSetting("HostXine"); + hostparm.ThisHostwebmin = gContext->GetSetting("Hostwebmin"); + hostparm.ThisHostfuppes = gContext->GetSetting("Hostfuppes"); ++ hostparm.ThisHostfoldingathome = gContext->GetSetting("Hostfoldingathome"); ++ hostparm.ThisHostfoldingusername = gContext->GetSetting("Hostfoldingusername"); ++ hostparm.ThisHostfoldingworksize = gContext->GetSetting("Hostfoldingworksize"); + hostparm.ThisHostDDnslogin = gContext->GetSetting("HostDDnslogin"); + hostparm.ThisHostDDnspassword = gContext->GetSetting("HostDDnspassword"); + hostparm.ThisHostDDnshostname = gContext->GetSetting("HostDDnshostname"); +@@ -4252,6 +4319,9 @@ + myfile << "xine=\"" + hostparm.ThisHostXine + "\"\n"; + myfile << "webmin=\"" + hostparm.ThisHostwebmin + "\"\n"; + myfile << "fuppes=\"" + hostparm.ThisHostfuppes + "\"\n"; ++ myfile << "foldingathome=\"" + hostparm.ThisHostfoldingathome + "\"\n"; ++ myfile << "foldingusername=\"" + hostparm.ThisHostfoldingusername + "\"\n"; ++ myfile << "foldingworksize=\"" + hostparm.ThisHostfoldingworksize + "\"\n"; + + + +@@ -4562,8 +4632,14 @@ + ConfigurationGroup *GridShowPlugin5 = new GridConfigurationGroup(2); + GridShowPlugin5->addChild(Hostfuppes()); + ++ ConfigurationGroup *GridShowPlugin6 = new VerticalConfigurationGroup(true,true); ++ GridShowPlugin6->addChild(Hostfoldingathome()); ++ GridShowPlugin6->addChild(Hostfoldingusername()); ++ GridShowPlugin6->addChild(Hostfoldingworksize()); ++ + addChild(GridShowPlugin4); + addChild(GridShowPlugin5); ++ addChild(GridShowPlugin6); + } + } + if ( displayuser ) +diff -Naru mythinstall/src/MythVantage-app/mythinstall/installsettings.h mythinstall-tz/src/MythVantage-app/mythinstall/installsettings.h +--- mythinstall/src/MythVantage-app/mythinstall/installsettings.h 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/installsettings.h 2010-02-28 16:56:31.000000000 +1030 +@@ -468,6 +468,9 @@ + QString ThisHostXine; + QString ThisHostwebmin; + QString ThisHostfuppes; ++ QString ThisHostfoldingathome; ++ QString ThisHostfoldingusername; ++ QString ThisHostfoldingworksize; + + QString ThisHostDDnslogin; + QString ThisHostDDnspassword; +diff -Naru mythinstall/src/MythVantage-app/mythinstall/misc_settings.cpp mythinstall-tz/src/MythVantage-app/mythinstall/misc_settings.cpp +--- mythinstall/src/MythVantage-app/mythinstall/misc_settings.cpp 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/misc_settings.cpp 2010-02-28 18:28:56.000000000 +1030 +@@ -80,8 +80,6 @@ + else + miscsettings_2->addChild(HostZipcode()); + +- +- + TimezoneRegion *timezoneregion = new TimezoneRegion(); + TimezoneButton *timezonebutton = new TimezoneButton(); + +@@ -96,13 +94,11 @@ + } + else + miscsettings->addChild(timezoneregion); +- + } + else + miscsettings->addChild(timezoneregion); + +-// button removed because it's borken +-// miscsettings->addChild(timezonebutton); ++ miscsettings->addChild(timezonebutton); + miscsettings->addChild(miscsettings_2); + addChild(miscsettings); + connect(timezonebutton, SIGNAL(mf_launch_tzgui()),timezoneregion ,SLOT(timezone_gathersettings())); +@@ -110,23 +106,35 @@ + connect(timezoneregion,SIGNAL(mf_show_tz(QString)),this,SLOT(mf_show_tz(QString))); + connect(this,SIGNAL(update_timezone(QString)),timezoneregion,SLOT(update_timezone_values(QString))); + +- +- } ++ autoLaunchTimer = new QTimer(this); ++ connect(autoLaunchTimer, SIGNAL(timeout()), timezonebutton, SLOT(launch_tzgui())); ++ autoLaunchTimer->start(0); ++} + + QString MiscMainFrame::mf_show_tz(QString tz) + { + QString GTimezone; + int rc; + +- //launch tzgui and load output into Gtimezone ++ if (autoLaunchTimer->isActive()) ++ { ++ autoLaunchTimer->stop(); ++ ++ // This was triggered by the timer. Only launch the timezone gui if the timezone is unknown. ++ if (!timezone_unknown) ++ return NULL; ++ } ++ ++ if ((tz == "") || timezone_unknown) ++ tz = "guess"; ++ ++ //launch tzgui and load output into Gtimezone + int m_screenheight = 0, m_screenwidth = 0; + float m_wmult = 0, m_hmult = 0; + QString m_height , m_width , cmd; + GetMythUI()->GetScreenSettings(m_screenwidth, m_wmult, m_screenheight, m_hmult); + m_height.setNum(m_screenheight); + m_width.setNum(m_screenwidth); +- +- + QString tzpath; + tzpath=MV_ROOT; + tzpath.append("bin/timezone.bin"); +@@ -152,17 +160,17 @@ + } + file.close(); + } ++ timezone_unknown = FALSE; + emit update_timezone(GTimezone); + } + ++ return GTimezone; + } + +- + //_______________Misc main frame + MiscMainFrame2::MiscMainFrame2(): + VerticalConfigurationGroup(false,false,false,false) + { +- + VerticalConfigurationGroup* miscsettings = + new VerticalConfigurationGroup(false, true,false,false); + +@@ -177,21 +185,20 @@ + miscsettings->addChild(miscsettings_2); + + addChild(miscsettings); +- +- } ++} + + + //_______________Misc time timezone + + TimezoneButton::TimezoneButton(): + VerticalConfigurationGroup(false,false,false,false) +- { ++{ + TZButton = new TransButtonSetting; + TZButton->setLabel("Hitchhikers guide to timezones"); + addChild(TZButton); + connect(TZButton, SIGNAL(pressed()),this,SLOT(launch_tzgui())); + +- }; ++}; + + void TimezoneButton::launch_tzgui() + { +@@ -203,8 +210,6 @@ + TZButton->setEnabled(false); + } + +- +- + //This is used for the timezone + QStringList findFilesRecursively ( QStringList paths, QString fileTypes ) { + if ( fileTypes.isEmpty() ) fileTypes = "*"; +@@ -228,10 +233,8 @@ + return result; // yields absolute paths + } + +- + void TimezoneRegion::timezoneregion_fillselection_zone() + { +- + HostTimeZoneRegion->setLabel(QObject::tr("TimeZone")); + HostTimeZoneRegion->addSelection("US"); + HostTimeZoneRegion->addSelection("Pacific"); +@@ -297,7 +300,6 @@ + HostTimeZoneRegion->addSelection("CST6CDT"); + HostTimeZoneRegion->addSelection("CET"); + HostTimeZoneRegion->setHelpText(QObject::tr("Timezone Region")); +- + } + + void TimezoneRegion::timezoneregion_fillselection(QString tzonefile ) +@@ -514,8 +516,8 @@ + addTarget("Cuba", new VerticalConfigurationGroup(false, false)); + addTarget("CST6CDT", new VerticalConfigurationGroup(false, false)); + addTarget("CET", new VerticalConfigurationGroup(false, false)); +- + }; ++ + void TimezoneRegion::update_timezone_values(QString Gtimezone) + { + QString region; +@@ -523,6 +525,7 @@ + region=Gtimezone.section('/',0,0); + subregion=Gtimezone.section('/',1,1); + HostTimeZoneRegion->setValue(region); ++ + if ( region == "US") + HostTimezoneRegion_US->setValue(subregion); + else if ( region == "Pacific") +diff -Naru mythinstall/src/MythVantage-app/mythinstall/misc_settings.h mythinstall-tz/src/MythVantage-app/mythinstall/misc_settings.h +--- mythinstall/src/MythVantage-app/mythinstall/misc_settings.h 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/misc_settings.h 2010-02-28 16:56:31.000000000 +1030 +@@ -20,6 +20,7 @@ + Q_OBJECT + public: + MiscMainFrame(); ++ QTimer *autoLaunchTimer; + + public slots: + QString mf_show_tz(QString); +diff -Naru mythinstall/src/MythVantage-app/mythinstall/mv_common.h mythinstall-tz/src/MythVantage-app/mythinstall/mv_common.h +--- mythinstall/src/MythVantage-app/mythinstall/mv_common.h 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/mv_common.h 2010-02-28 16:56:31.000000000 +1030 +@@ -1,4 +1,5 @@ + //#define __MVAPP__ MythVantage + #define RELEASEFILE "LinHES-release" + ++extern int timezone_unknown; + +diff -Naru mythinstall/src/MythVantage-app/mythinstall/xorgsettings.cpp mythinstall-tz/src/MythVantage-app/mythinstall/xorgsettings.cpp +--- mythinstall/src/MythVantage-app/mythinstall/xorgsettings.cpp 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/xorgsettings.cpp 2010-02-28 16:56:31.000000000 +1030 +@@ -261,7 +261,7 @@ + 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"); +@@ -429,7 +429,7 @@ + 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"); +@@ -479,10 +479,9 @@ + addTarget("ATSC", HostXNvidiaadvancedresATSC); + addTarget("DVD", HostXNvidiaadvancedresDVD); + addTarget("NTSC", HostXNvidiaadvancedresNTSC); +- addTarget("Custom",HostXNvidiaadvancedresCustom); +- addTarget("Nvidia_modeline",nVidiastandard); ++ addTarget("Custom", HostXNvidiaadvancedresCustom); ++ addTarget("nVidia modeline", nVidiastandard); + addTarget("Auto", new VerticalConfigurationGroup(false, false)); +- + }; + + +@@ -513,7 +512,7 @@ + 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 -Naru mythinstall/src/MythVantage-app/mythinstall/xorgsettings.h mythinstall-tz/src/MythVantage-app/mythinstall/xorgsettings.h +--- mythinstall/src/MythVantage-app/mythinstall/xorgsettings.h 2010-02-28 17:03:23.000000000 +1030 ++++ mythinstall-tz/src/MythVantage-app/mythinstall/xorgsettings.h 2010-02-28 16:56:31.000000000 +1030 +@@ -4,8 +4,6 @@ + #include "libmyth/mythwidgets.h" + #include "installsettings.h" + +- +- + class AdvancedXNvidiaConnections: public TriggeredConfigurationGroup { + Q_OBJECT + public: +@@ -104,9 +102,77 @@ + { + HostComboBox *gc = new HostComboBox("HostXres"); + gc->setLabel(QObject::tr("Initial resolution")); +- gc->addSelection("800x600"); +- gc->addSelection("1280x720") ; +- gc->addSelection("Auto") ; +- gc->setHelpText(QObject::tr("")); ++ ++ const int num_defaults = 2; ++ char *defaults[num_defaults]={"800x600","1280x720"}; ++ int defaults_added[num_defaults]={0,0}; ++ int found_modes_in_xorg_log = FALSE; ++ ++ 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. ++ modelines = popen (mode_extract_command, "r"); ++ ++ char previous_mode[200]={0}; ++ ++ 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; ++ separator++; ++ ++ // Skip this mode if the description is identical to the previous. ++ if (strcmp (previous_mode, separator) == 0) ++ continue; ++ ++ strncpy (previous_mode, separator, sizeof (previous_mode)); ++ gc->addSelection(separator, line_in); ++ found_modes_in_xorg_log = TRUE; ++ ++ for (int def = 0; def < num_defaults; def++) ++ if (strncmp (&line_in[1], defaults[def], strlen (defaults[def]))==0) ++ defaults_added[def]=1; ++ } ++ } ++ pclose (modelines); ++ } ++ } ++ ++ for (int def = 0; def < num_defaults; def++) ++ if (!defaults_added[def]) ++ gc->addSelection(defaults[def], defaults[def]); ++ ++ if (found_modes_in_xorg_log) ++ gc->setHelpText(QObject::tr("Choose a resolution to match your display and a refresh rate to match the content you will be recording - 60 Hz for NTSC (e.g. US) 50 Hz for PAL (e.g. UK, Aust, NZ).")); ++ else ++ gc->setHelpText(QObject::tr("Choose the resolution to use when the system reboots.")); ++ + return gc; + } -- cgit v0.12