diff options
Diffstat (limited to 'abs/core-testing/mythinstall/xorgsettings.h')
-rwxr-xr-x | abs/core-testing/mythinstall/xorgsettings.h | 58 |
1 files changed, 53 insertions, 5 deletions
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; } |