File indexing completed on 2024-04-21 15:08:08

0001 /***************************************************************************
0002                          csession.h  -  basis of multi-world support
0003                           -------------------
0004     begin                : Pi nov 15 2002
0005     copyright            : (C) 2002 by Tomas Mecir
0006     email                : kmuddy@kmuddy.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CSESSION_H
0019 #define CSESSION_H
0020 
0021 #include <config-mxp.h>
0022 #include "cactionbase.h"
0023 
0024 #include <QWidget>
0025 
0026 class cTelnet;
0027 class cANSIParser;
0028 class cOutput;
0029 class cInputLine;
0030 class cMultiInputLine;
0031 class cCmdParser;
0032 class cCmdProcessor;
0033 class cCmdQueues;
0034 class cTextProcessor;
0035 class cStatus;
0036 class cConnection;
0037 class cTranscript;
0038 class cPrompt;
0039 class cGaugeBar;
0040 class cScriptAPI;
0041 class cScriptEval;
0042 
0043 #ifdef HAVE_MXP
0044 class cMXPManager;
0045 #endif  //HAVE_MXP
0046 
0047 /**
0048 This class handles one session.
0049 It's the basis of multi-world support.
0050 It's the widget that contains inputline, console and friends for one active connection.
0051   *@author Tomas Mecir
0052   */
0053 
0054 class cSession : public QWidget, public cActionBase {
0055    Q_OBJECT
0056 public: 
0057   cSession (int sess, QWidget *parent=nullptr);
0058   ~cSession () override;
0059 
0060   //name
0061   void setName (const QString &name, bool defName = true);
0062   const QString &name () { return _name; };
0063   //flashing
0064   void setFlashing (bool val) { _flashing = val; };
0065   bool flashing () { return _flashing; };
0066 
0067   void setAuxInput (bool val);
0068 
0069   QString actionNothingHandler (QString action, int session) override;
0070   void eventNothingHandler (QString event, int session) override;
0071   void eventStringHandler (QString event, int session, QString &par1, const QString &par2) override;
0072 protected slots:
0073   /** switch between standard input and multi-line input */
0074   void switchInputLines ();
0075 
0076 protected:
0077   //flashing
0078   bool _flashing;
0079   //name
0080   QString _name;
0081   //do we have a default name ?
0082   bool defaultName;
0083   
0084   //objects
0085   cTelnet *_telnet;
0086   cANSIParser *_ansiparser;
0087   cOutput *_output;
0088   cInputLine *_inputline, *_auxinputline;
0089   cMultiInputLine *_multiinputline;
0090   cCmdParser *_parser;
0091   cCmdQueues *_cmdqueues;
0092   cCmdProcessor *_cmdproc;
0093   cTextProcessor *_textproc;
0094   cStatus *_status;
0095   cConnection *_connection;
0096   cTranscript *_transcript;
0097   cPrompt *_prompt;
0098   cGaugeBar *_gaugebar;
0099   cScriptAPI *_scriptapi;
0100   cScriptEval *_scripteval;
0101 #ifdef HAVE_MXP
0102   cMXPManager *_mxpmanager;
0103 #endif //HAVE_MXP
0104 };
0105 
0106 #endif