| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
<PropertyList> |
| 4 |
<name>fgcom</name> |
| 5 |
<layout>vbox</layout> |
| 6 |
<resizable>false</resizable> |
| 7 |
|
| 8 |
<nasal> |
| 9 |
<open><![CDATA[ |
| 10 |
var autofill = func { |
| 11 |
if ((getprop("/sim/fgcom/selected-server") == nil) or |
| 12 |
(getprop("/sim/fgcom/selected-server") == "" ) ){ |
| 13 |
var tx = getprop("/sim/fgcom/server"); |
| 14 |
var dlg = cmdarg(); |
| 15 |
#var servers = cmdarg().getChildren("group")[5].getChildren("combo")[0].getChildren("value"); |
| 16 |
var servers = props.globals.getNode("/sim/gui/dialogs/multiplay/fgcom-servers", 1); |
| 17 |
foreach (var s; servers.getChildren("value")) { |
| 18 |
var server = s.getValue(); |
| 19 |
var host = split(" ", server)[0]; |
| 20 |
if (host == tx) { |
| 21 |
setprop("/sim/fgcom/selected-server", server); |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
var servers = props.globals.getNode("/sim/gui/dialogs/multiplay/fgcom-servers", 1); |
| 28 |
var updateServers = func { |
| 29 |
servers.removeChildren("value"); |
| 30 |
# get the results list from the server |
| 31 |
var serverlist = props.globals.getNode("/sim/multiplay/server-list", 1); |
| 32 |
|
| 33 |
var i=0; |
| 34 |
foreach (var s; serverlist.getChildren("fgcom")) { |
| 35 |
|
| 36 |
if (!s.getNode("online").getBoolValue()) { |
| 37 |
continue; # skip offline servers |
| 38 |
} |
| 39 |
|
| 40 |
# label is name and location, for the moment |
| 41 |
# should we include the number of users? or wait until we |
| 42 |
# have a better UI toolkit? |
| 43 |
var nm = s.getNode("hostname").getValue() ~ " - " ~ s.getNode("location").getValue(); |
| 44 |
servers.getNode("value[" ~ i ~ "]", 1).setValue(nm); |
| 45 |
i += 1; |
| 46 |
} |
| 47 |
|
| 48 |
autofill(); |
| 49 |
gui.dialog_update("fgcom", "server"); |
| 50 |
} |
| 51 |
|
| 52 |
var static_serverList = [ |
| 53 |
['fgcom.flightgear.org', 'Avignon, France'] |
| 54 |
]; |
| 55 |
|
| 56 |
var updateServersFailed = func { |
| 57 |
debug.dump("Failed to retrieve server list!"); |
| 58 |
|
| 59 |
servers.removeChildren("value"); |
| 60 |
var i=0; |
| 61 |
foreach (var s; static_serverList) { |
| 62 |
# create the node the PUI combo |
| 63 |
var nm = s[0] ~ " - " ~ s[1]; |
| 64 |
servers.getNode("value[" ~ i ~ "]", 1).setValue(nm); |
| 65 |
i += 1; |
| 66 |
} |
| 67 |
|
| 68 |
autofill(); |
| 69 |
gui.dialog_update("fgcom", "server"); |
| 70 |
} |
| 71 |
|
| 72 |
# listen for results arriving |
| 73 |
setlistener("/sim/multiplay/got-servers", updateServers); |
| 74 |
setlistener("/sim/multiplay/get-servers-failure", updateServersFailed); |
| 75 |
|
| 76 |
fgcommand("xmlhttprequest", props.Node.new({ |
| 77 |
"url" : "http://liveries.flightgear.org/mpstatus/mpservers.xml", |
| 78 |
"targetnode" : "/sim/multiplay/server-list", |
| 79 |
"complete" : "/sim/multiplay/got-servers", |
| 80 |
"failure" : "/sim/multiplay/get-servers-failure" |
| 81 |
})); |
| 82 |
]]> |
| 83 |
</open> |
| 84 |
<close> |
| 85 |
</close> |
| 86 |
</nasal> |
| 87 |
|
| 88 |
|
| 89 |
<group> |
| 90 |
<layout>hbox</layout> |
| 91 |
|
| 92 |
<text> |
| 93 |
<label>FGCom Settings</label> |
| 94 |
</text> |
| 95 |
|
| 96 |
<empty> |
| 97 |
<stretch>1</stretch> |
| 98 |
</empty> |
| 99 |
|
| 100 |
<button> |
| 101 |
<pref-width>20</pref-width> |
| 102 |
<pref-height>20</pref-height> |
| 103 |
<legend>?</legend> |
| 104 |
<binding> |
| 105 |
<command>open-browser</command> |
| 106 |
<path>http://wiki.flightgear.org/FGCom_3.0</path> |
| 107 |
</binding> |
| 108 |
</button> |
| 109 |
|
| 110 |
<button> |
| 111 |
<legend>X</legend> |
| 112 |
<key>Esc</key> |
| 113 |
<pref-width>20</pref-width> |
| 114 |
<pref-height>20</pref-height> |
| 115 |
<binding> |
| 116 |
<command>dialog-close</command> |
| 117 |
</binding> |
| 118 |
</button> |
| 119 |
|
| 120 |
</group> |
| 121 |
<hrule/> |
| 122 |
|
| 123 |
|
| 124 |
<group> |
| 125 |
<layout>table</layout> |
| 126 |
<halign>left</halign> |
| 127 |
|
| 128 |
<text> |
| 129 |
<row>0</row> |
| 130 |
<col>0</col> |
| 131 |
<label>Enabled:</label> |
| 132 |
<halign>right</halign> |
| 133 |
<enable> |
| 134 |
<equals> |
| 135 |
<property>/sim/fgcom/test</property> |
| 136 |
<value>0</value> |
| 137 |
</equals> |
| 138 |
</enable> |
| 139 |
</text> |
| 140 |
<checkbox> |
| 141 |
<row>0</row> |
| 142 |
<col>1</col> |
| 143 |
<colspan>2</colspan> |
| 144 |
<halign>left</halign> |
| 145 |
<name>enabled</name> |
| 146 |
<label></label> |
| 147 |
<live>1</live> |
| 148 |
<enable> |
| 149 |
<equals> |
| 150 |
<property>/sim/fgcom/test</property> |
| 151 |
<value>0</value> |
| 152 |
</equals> |
| 153 |
</enable> |
| 154 |
<property>/sim/fgcom/enabled</property> |
| 155 |
<binding> |
| 156 |
<command>dialog-apply</command> |
| 157 |
<object-name>enabled</object-name> |
| 158 |
</binding> |
| 159 |
</checkbox> |
| 160 |
|
| 161 |
<text> |
| 162 |
<row>1</row> |
| 163 |
<col>0</col> |
| 164 |
<label> Display messages:</label> |
| 165 |
<halign>right</halign> |
| 166 |
</text> |
| 167 |
<checkbox> |
| 168 |
<row>1</row> |
| 169 |
<col>1</col> |
| 170 |
<colspan>2</colspan> |
| 171 |
<halign>left</halign> |
| 172 |
<name>showMessages</name> |
| 173 |
<label></label> |
| 174 |
<live>1</live> |
| 175 |
<property>/sim/fgcom/show-messages</property> |
| 176 |
<binding> |
| 177 |
<command>dialog-apply</command> |
| 178 |
<object-name>showMessages</object-name> |
| 179 |
</binding> |
| 180 |
</checkbox> |
| 181 |
<text> |
| 182 |
<row>1</row> |
| 183 |
<col>1</col> |
| 184 |
<label> (for debug only)</label> |
| 185 |
<halign>left</halign> |
| 186 |
</text> |
| 187 |
|
| 188 |
<text> |
| 189 |
<row>3</row> |
| 190 |
<col>0</col> |
| 191 |
<label>Echo test:</label> |
| 192 |
<halign>right</halign> |
| 193 |
<enable> |
| 194 |
<equals> |
| 195 |
<property>/sim/fgcom/enabled</property> |
| 196 |
<value>1</value> |
| 197 |
</equals> |
| 198 |
</enable> |
| 199 |
</text> |
| 200 |
<checkbox> |
| 201 |
<row>3</row> |
| 202 |
<col>1</col> |
| 203 |
<colspan>2</colspan> |
| 204 |
<halign>left</halign> |
| 205 |
<name>test</name> |
| 206 |
<label></label> |
| 207 |
<enable> |
| 208 |
<equals> |
| 209 |
<property>/sim/fgcom/enabled</property> |
| 210 |
<value>1</value> |
| 211 |
</equals> |
| 212 |
</enable> |
| 213 |
<live>1</live> |
| 214 |
<property>/sim/fgcom/test</property> |
| 215 |
<binding> |
| 216 |
<command>dialog-apply</command> |
| 217 |
<object-name>test</object-name> |
| 218 |
</binding> |
| 219 |
</checkbox> |
| 220 |
|
| 221 |
<text> |
| 222 |
<row>4</row> |
| 223 |
<col>0</col> |
| 224 |
<label>PTT test:</label> |
| 225 |
<halign>right</halign> |
| 226 |
<enable> |
| 227 |
<equals> |
| 228 |
<property>/sim/fgcom/enabled</property> |
| 229 |
<value>-1</value> |
| 230 |
</equals> |
| 231 |
</enable> |
| 232 |
</text> |
| 233 |
<checkbox> |
| 234 |
<row>4</row> |
| 235 |
<col>1</col> |
| 236 |
<colspan>2</colspan> |
| 237 |
<halign>left</halign> |
| 238 |
<name>ptt-test</name> |
| 239 |
<label></label> |
| 240 |
<enable> |
| 241 |
<equals> |
| 242 |
<property>/sim/fgcom/enabled</property> |
| 243 |
<value>-1</value> |
| 244 |
</equals> |
| 245 |
</enable> |
| 246 |
<live>1</live> |
| 247 |
<property>/controls/radios/comm-ptt</property> |
| 248 |
<binding> |
| 249 |
<command>dialog-apply</command> |
| 250 |
<object-name>ptt-test</object-name> |
| 251 |
</binding> |
| 252 |
</checkbox> |
| 253 |
<text> |
| 254 |
<row>4</row> |
| 255 |
<col>1</col> |
| 256 |
<label> 1</label> |
| 257 |
<format> %.0f</format> |
| 258 |
<live>true</live> |
| 259 |
<halign>left</halign> |
| 260 |
<property>/controls/radios/comm-ptt</property> |
| 261 |
</text> |
| 262 |
<text> |
| 263 |
<row>4</row> |
| 264 |
<col>1</col> |
| 265 |
<label> (/controls/radios/comm-ptt) </label> |
| 266 |
<halign>left</halign> |
| 267 |
</text> |
| 268 |
|
| 269 |
|
| 270 |
<text> |
| 271 |
<row>5</row> |
| 272 |
<col>0</col> |
| 273 |
<label>Speaker volume:</label> |
| 274 |
<halign>right</halign> |
| 275 |
</text> |
| 276 |
<slider> |
| 277 |
<row>5</row> |
| 278 |
<col>1</col> |
| 279 |
<halign>left</halign> |
| 280 |
<name>speaker-vol</name> |
| 281 |
<label></label> |
| 282 |
<min>0</min> |
| 283 |
<max>1.0</max> |
| 284 |
<step>0.1</step> |
| 285 |
<property>/sim/fgcom/speaker-level</property> |
| 286 |
<binding> |
| 287 |
<command>dialog-apply</command> |
| 288 |
<object-name>speaker-vol</object-name> |
| 289 |
</binding> |
| 290 |
</slider> |
| 291 |
<text> |
| 292 |
<row>5</row> |
| 293 |
<col>1</col> |
| 294 |
<label>1234 </label> |
| 295 |
<format>%.1f</format> |
| 296 |
<live>true</live> |
| 297 |
<halign>right</halign> |
| 298 |
<property>/sim/fgcom/speaker-level</property> |
| 299 |
</text> |
| 300 |
|
| 301 |
<text> |
| 302 |
<row>6</row> |
| 303 |
<col>0</col> |
| 304 |
<label>Silence threshold:</label> |
| 305 |
<halign>right</halign> |
| 306 |
</text> |
| 307 |
<slider> |
| 308 |
<row>6</row> |
| 309 |
<col>1</col> |
| 310 |
<halign>left</halign> |
| 311 |
<name>silence-thd</name> |
| 312 |
<label></label> |
| 313 |
<min>-60.0</min> |
| 314 |
<max>0.0</max> |
| 315 |
<step>1</step> |
| 316 |
<property>/sim/fgcom/silence-threshold</property> |
| 317 |
<binding> |
| 318 |
<command>dialog-apply</command> |
| 319 |
<object-name>silence-thd</object-name> |
| 320 |
</binding> |
| 321 |
</slider> |
| 322 |
<text> |
| 323 |
<row>6</row> |
| 324 |
<col>1</col> |
| 325 |
<label>1234 dB </label> |
| 326 |
<format>%.1f dB</format> |
| 327 |
<live>true</live> |
| 328 |
<halign>right</halign> |
| 329 |
<property>/sim/fgcom/silence-threshold</property> |
| 330 |
</text> |
| 331 |
</group> |
| 332 |
|
| 333 |
<hrule/> |
| 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 |
|
| 455 |
|
| 456 |
|
| 457 |
<group> |
| 458 |
<layout>hbox</layout> |
| 459 |
<empty> |
| 460 |
<stretch>1</stretch> |
| 461 |
</empty> |
| 462 |
|
| 463 |
<text> |
| 464 |
<label>Server</label> |
| 465 |
<enable> |
| 466 |
<and> |
| 467 |
<equals> |
| 468 |
<property>/sim/fgcom/enabled</property> |
| 469 |
<value>1</value> |
| 470 |
</equals> |
| 471 |
<equals> |
| 472 |
<property>/sim/fgcom/test</property> |
| 473 |
<value>0</value> |
| 474 |
</equals> |
| 475 |
</and> |
| 476 |
</enable> |
| 477 |
</text> |
| 478 |
|
| 479 |
<empty> |
| 480 |
<stretch>1</stretch> |
| 481 |
</empty> |
| 482 |
</group> |
| 483 |
|
| 484 |
<group> |
| 485 |
<layout>table</layout> |
| 486 |
<halign>center</halign> |
| 487 |
<default-padding>10</default-padding> |
| 488 |
|
| 489 |
<combo> |
| 490 |
<name>server</name> |
| 491 |
<row>1</row> |
| 492 |
<col>0</col> |
| 493 |
<colspan>6</colspan> |
| 494 |
<pref-width>350</pref-width> |
| 495 |
<editable>false</editable> |
| 496 |
<property>/sim/fgcom/selected-server</property> |
| 497 |
<properties>/sim/gui/dialogs/multiplay/fgcom-servers</properties> |
| 498 |
<enable> |
| 499 |
<and> |
| 500 |
<equals> |
| 501 |
<property>/sim/fgcom/enabled</property> |
| 502 |
<value>1</value> |
| 503 |
</equals> |
| 504 |
<equals> |
| 505 |
<property>/sim/fgcom/test</property> |
| 506 |
<value>0</value> |
| 507 |
</equals> |
| 508 |
</and> |
| 509 |
</enable> |
| 510 |
<binding> |
| 511 |
<command>dialog-apply</command> |
| 512 |
<object-name>server</object-name> |
| 513 |
</binding> |
| 514 |
<binding> |
| 515 |
<command>nasal</command> |
| 516 |
<script> |
| 517 |
<![CDATA[ |
| 518 |
var server = getprop("/sim/fgcom/selected-server"); |
| 519 |
server = split(" ", server)[0]; |
| 520 |
if (server == getprop("/sim/fgcom/server")) { |
| 521 |
# if the value isn't changing, don't disable+re-enable |
| 522 |
return; |
| 523 |
} |
| 524 |
|
| 525 |
logprint(LOG_INFO, "Selecting new FGCom sever:" ~ server); |
| 526 |
var wasEnabled = getprop("/sim/fgcom/enabled"); |
| 527 |
setprop("/sim/fgcom/enabled", 0); |
| 528 |
|
| 529 |
# this value is only read when re-enabling |
| 530 |
setprop("/sim/fgcom/server", server); |
| 531 |
|
| 532 |
if (wasEnabled) { |
| 533 |
# re-enable after changing server |
| 534 |
setprop("/sim/fgcom/enabled", 1); |
| 535 |
} |
| 536 |
]]> |
| 537 |
</script> |
| 538 |
</binding> |
| 539 |
<binding> |
| 540 |
<command>dialog-apply</command> |
| 541 |
<object-name>test</object-name> |
| 542 |
</binding> |
| 543 |
</combo> |
| 544 |
|
| 545 |
</group> |
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
<hrule/> |
| 550 |
<group> |
| 551 |
<layout>hbox</layout> |
| 552 |
<default-padding>5</default-padding> |
| 553 |
<empty> |
| 554 |
<stretch>true</stretch> |
| 555 |
</empty> |
| 556 |
|
| 557 |
<button> |
| 558 |
<legend>Close</legend> |
| 559 |
<default>true</default> |
| 560 |
<equal>true</equal> |
| 561 |
<binding> |
| 562 |
<command>dialog-close</command> |
| 563 |
</binding> |
| 564 |
</button> |
| 565 |
|
| 566 |
<empty> |
| 567 |
<stretch>true</stretch> |
| 568 |
</empty> |
| 569 |
</group> |
| 570 |
|
| 571 |
</PropertyList> |
| 572 |
|