MCPcopy Index your code
hub / github.com/NetHack/NetHack / qt_display_file

Method qt_display_file

win/Qt/qt_bind.cpp:450–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void 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
483void NetHackQtBind::qt_start_menu(winid wid, unsigned long mbehavior UNUSED)
484{

Callers

nothing calls this directly

Calls 8

dlb_fopenFunction · 0.85
dlb_fgetsFunction · 0.85
tabexpandFunction · 0.85
dlb_fcloseFunction · 0.85
nh_qsprintfFunction · 0.85
ClearMethod · 0.45
PutStrMethod · 0.45
DisplayMethod · 0.45

Tested by

no test coverage detected