1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
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;
}
|