File indexing completed on 2024-10-06 09:45:56
0001 /*************************************************************************** 0002 ctrigger.h - trigger 0003 This file is a part of KMuddy distribution. 0004 ------------------- 0005 begin : Ne okt 13 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 CTRIGGER_H 0020 #define CTRIGGER_H 0021 0022 #include "csaveablefield.h" 0023 0024 class cTriggerList; 0025 0026 #include <qcolor.h> 0027 0028 #include <map> 0029 0030 #define MAX_COLORIZATIONS 10 0031 0032 using namespace std; 0033 0034 /** 0035 One trigger. 0036 *@author Tomas Mecir 0037 */ 0038 0039 class cTrigger : public cSaveableField { 0040 public: 0041 cTrigger (int _sess); 0042 ~cTrigger () override; 0043 0044 /** creates a new instance of the class */ 0045 cSaveableField *newInstance () override; 0046 0047 /** load data from a config file*/ 0048 void load (KConfig *config, const QString &group) override; 0049 0050 /** returns type of item (light-weight RTTI) */ 0051 int itemType () override { return TYPE_TRIGGER; }; 0052 0053 bool dontSend () { return dontsend; }; 0054 void setDontSend (bool what) { dontsend = what; }; 0055 0056 bool continueIfMatch () { return continueifmatch; }; 0057 bool continueIfNoMatch () { return continueifnomatch; }; 0058 0059 bool isColorTrigger () { return colortrigger; }; 0060 void setColorTrigger (bool what) { colortrigger = what; }; 0061 bool isGagTrigger () { return gagtrigger; }; 0062 void setGagTrigger (bool what) { gagtrigger = what; }; 0063 bool isRewriteTrigger () { return rewritetrigger; }; 0064 void setRewriteTrigger (bool what) { rewritetrigger = what; }; 0065 bool isNotifyTrigger () { return notifytrigger; }; 0066 void setNotifyTrigger (bool what) { notifytrigger = what; }; 0067 bool isPromptDetectTrigger () { return prompttrigger; }; 0068 void setPromptDetectTrigger (bool what) { prompttrigger = what; }; 0069 bool isSoundTrigger () { return soundtrigger; }; 0070 void setSoundTrigger (bool what) { soundtrigger = what; }; 0071 0072 void setOutputWindowTrigger (bool what) { outputwindowtrigger = what; }; 0073 bool isOutputWindowTrigger() { return outputwindowtrigger; }; 0074 0075 void setGagOutputWindow (bool what) { gagoutputwindow = what; }; 0076 bool isGagOutputWindow() { return gagoutputwindow; }; 0077 0078 void setOutputWindowName (QString text) { outputwindowname = text; }; 0079 QString getOutputWindowName() { return outputwindowname; }; 0080 0081 void clearColorizations (); 0082 bool addColorization (QString pseudovar, int newcolors, QColor fgc, QColor bgc); 0083 int getColorizationsCount () { return colorizationCount; }; 0084 QString getColorizationVariable (int num); 0085 int getColorizationColor (int num); 0086 QColor getColorizationFg (int num); 0087 QColor getColorizationBg (int num); 0088 0089 QString rewriteVar () { return rewritevar; }; 0090 QString rewriteText () { return rewritetext; }; 0091 void setRewriteVar (const QString &val) { rewritevar = val; }; 0092 void setRewriteText (const QString &val) { rewritetext = val; }; 0093 0094 const QString &soundFileName () { return soundFName; }; 0095 void setSoundFileName (const QString & fName) { soundFName = fName; }; 0096 protected: 0097 0098 bool continueifmatch, continueifnomatch; 0099 bool dontsend; 0100 0101 bool colortrigger, gagtrigger, notifytrigger, prompttrigger, rewritetrigger; 0102 bool soundtrigger; 0103 bool outputwindowtrigger; 0104 bool gagoutputwindow; 0105 QString outputwindowname; 0106 0107 int colorizationCount; 0108 QString colorizationVar[MAX_COLORIZATIONS]; 0109 int colorization[MAX_COLORIZATIONS]; 0110 QColor fgcol[MAX_COLORIZATIONS], bgcol[MAX_COLORIZATIONS]; 0111 0112 /** what to rewrite, and with what */ 0113 QString rewritevar, rewritetext; 0114 0115 QString soundFName; 0116 0117 /** used by colorization and rewrite triggers (in computePosition()) */ 0118 int fromIndex, length; 0119 0120 int sess; 0121 }; 0122 0123 #endif