File indexing completed on 2024-04-14 03:59:59

0001 /***************************************************************************
0002                           ctranscript.h  -  session transcript
0003     This file is a part of KMuddy distribution.
0004                              -------------------
0005     begin                : Ct oct 31 2002
0006     copyright            : (C) 2002 by Tomas Mecir
0007     email                : kmuddy@kmuddy.com
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either version 2 of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  ***************************************************************************/
0018 
0019 #ifndef CTRANSCRIPT_H
0020 #define CTRANSCRIPT_H
0021 
0022 #include <QObject>
0023 #include <QFile>
0024 
0025 #include "cactionbase.h"
0026 
0027 class dlgTranscript;
0028 class dlgDumpBuffer;
0029 class QTimer;
0030 
0031 /**
0032 This class handles session transcript feature.
0033   *@author Tomas Mecir
0034   */
0035 
0036 class cTranscript : public QObject, public cActionBase {
0037    Q_OBJECT
0038 private:
0039   QString directory, name;
0040 public: 
0041   cTranscript (int sess);
0042   ~cTranscript () override;
0043   
0044   void load();
0045   void save();
0046   
0047   void addLineToTranscript (cTextChunk *chunk);
0048   void addLineToAdvTranscript (cTextChunk *chunk);
0049   
0050   void stopTranscript ();
0051   void stopAdvTranscript ();
0052   void startAdvTranscript ();
0053   void setEnableRotate (bool val) { rotatedaily = val; };
0054   bool enableRotate () { return rotatedaily; };
0055   void setPrependTimestamp (bool val) { includetimestamp = val; };
0056   bool prependTimestamp () { return includetimestamp; };
0057 public slots:
0058   void configure ();
0059   void dumpBuffer ();
0060   void timeout ();
0061 protected slots:
0062   void applyTranscript ();
0063   void doDumpBuffer ();
0064 protected:
0065   void eventNothingHandler (QString event, int session) override;
0066   void eventChunkHandler (QString event, int session, cTextChunk *chunk) override;
0067   
0068   void startTranscript ();
0069   
0070   void setAFName (const QString &what);
0071   QString getAFName ();
0072 
0073   bool running, advrunning, rotatedaily;
0074   bool overwrite, includedump;
0075   bool includetimestamp;
0076   QFile file, advfile;
0077   QString fname, advfname, fileformat;
0078   QTimer *transtimer;
0079 
0080   //type of normal and advanced transcript
0081   int type, advtype;
0082   
0083   dlgTranscript *tdlg;
0084   dlgDumpBuffer *bdlg;
0085   
0086   bool nextLineGagged;
0087 };
0088 
0089 #endif