| 448 | } |
| 449 | |
| 450 | void NetHackQtBind::qt_display_file(const char *filename, boolean must_exist) |
| 451 | { |
| 452 | NetHackQtTextWindow* window=new NetHackQtTextWindow(mainWidget()); |
| 453 | bool complain = false; |
| 454 | |
| 455 | { |
| 456 | dlb *f; |
| 457 | char buf[BUFSZ]; |
| 458 | char *cr; |
| 459 | |
| 460 | window->Clear(); |
| 461 | f = dlb_fopen(filename, "r"); |
| 462 | if (!f) { |
| 463 | complain = must_exist; |
| 464 | } else { |
| 465 | while (dlb_fgets(buf, BUFSZ, f)) { |
| 466 | if ((cr = strchr(buf, '\n')) != 0) *cr = 0; |
| 467 | #ifdef MSDOS |
| 468 | if ((cr = strchr(buf, '\r')) != 0) *cr = 0; |
| 469 | #endif |
| 470 | window->PutStr(ATR_NONE, tabexpand(buf)); |
| 471 | } |
| 472 | window->Display(false); |
| 473 | (void) dlb_fclose(f); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | if (complain) { |
| 478 | QString message = nh_qsprintf("File not found: %s\n",filename); |
| 479 | QMessageBox::warning(NULL, "File Error", message, QMessageBox::Ignore); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED) |
| 484 | { |
nothing calls this directly
no test coverage detected