void cTranscript::applyTranscript () //handler of OK/Apply in transcript dialog { stopTranscript (); stopAdvTranscript(); overwrite = tdlg->isOverwrite (); includedump = tdlg->includeDump (); fname = tdlg->getFName (); type = tdlg->transcriptType(); fileformat = tdlg->getAFName(); setAFName (fileformat); if (tdlg->isEnabled ()) startTranscript (); rotatedaily = tdlg->rotateDaily(); includetimestamp = tdlg->includeTimestamp(); advtype = tdlg->advTranscriptType(); if(tdlg->advTranscript()) startAdvTranscript(); save(); }
void cTranscript::eventNothingHandler (QString event, int) { if (event == "disconnected") { stopTranscript (); stopAdvTranscript (); } else if (event == "will-gag") { nextLineGagged = true; } }
cTranscript::~cTranscript () { stopTranscript (); stopAdvTranscript (); removeEventHandler ("disconnected"); removeEventHandler ("will-gag"); removeEventHandler ("got-line-after-triggers"); removeEventHandler ("displayed-line"); removeEventHandler ("displayed-prompt"); }
/*====================================================================== terminate() Terminate the execution of the adventure, e.g. close windows, return buffers... */ void terminate(int code) { newline(); terminateStateStack(); stopTranscript(); if (memory) deallocate(memory); #ifdef HAVE_GLK glk_exit(); #else exit(code); #endif }
void cTranscript::startTranscript () { //we'll have multiple <html></html> sections in a transcript file if we continue an existing //one, but every browser that I've tested can handle it correctly :D if (running) stopTranscript (); cTelnet *telnet = dynamic_cast<cTelnet *>(object ("telnet")); if (!(telnet->isConnected())) //no transcript if we aren't connected return; errno = 0; file = fopen (fname.toLatin1(), overwrite ? "w" : "a"); if (file == NULL) { KMessageBox::detailedSorry (cActionManager::self()->mainWidget(), i18n ("Transcript file could not be opened."), strerror (errno)); errno = 0; invokeEvent ("message", sess(), i18n ("Session transcript could not be started.")); } else { running = true; cOutput *output = dynamic_cast<cOutput *>(object ("output")); fputs ("\n\n", file); if (type == TRANSCRIPT_HTML) { //TODO: what if we're adding to an existing HTML transcript? fputs ("<html>\n", file); fputs ("<meta name=\"Generator\" content=\"KMuddy\">\n", file); fputs ("<body bgcolor=", file); fputs (output->defaultBkColor().name().toLatin1(), file); fputs (">\n", file); } QString s = i18n ("Session transcript has just started."); fputs (s.toLatin1(), file); if (type == TRANSCRIPT_HTML) fputs ("<br><pre>", file); //pre-formatted text starting... fputs ("\n\n", file); //add buffer dump if requested if (includedump) output->console()->dumpBuffer (false, file, type); invokeEvent ("message", sess(), i18n ("Session transcript has been started.")); } }