Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
void cTranscript::eventNothingHandler (QString event, int)
{
  if (event == "disconnected") {
    stopTranscript ();
    stopAdvTranscript ();
  }
  else if (event == "will-gag") {
    nextLineGagged = true;
  }
}
Exemplo n.º 3
0
cTranscript::~cTranscript ()
{ 
  stopTranscript ();
  stopAdvTranscript ();

  removeEventHandler ("disconnected");
  removeEventHandler ("will-gag");
  removeEventHandler ("got-line-after-triggers");
  removeEventHandler ("displayed-line");
  removeEventHandler ("displayed-prompt");
}
Exemplo n.º 4
0
/*======================================================================

  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
}
Exemplo n.º 5
0
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."));
  }
}