File indexing completed on 2024-12-08 06:46:34

0001 /***************************************************************************
0002                           cconnprefs.h  -  connection preferences, aliases, ...
0003     This file is a part of KMuddy distribution.
0004                              -------------------
0005     begin                : Po Jul 22 2002
0006     copyright            : (C) 2002-2005 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 CCONNPREFS_H
0020 #define CCONNPREFS_H
0021 
0022 /*
0023  TODO: currently passwords are saved WITHOUT ANY ENCRYPTION!!!
0024    This must be changed.
0025    IMPORTANT: it must be possible to decode the password, as it's sent
0026    to the MUD unencrypted => MD5 and friends can NOT be used.
0027 */
0028 
0029 #include <qstring.h>
0030 #include <qstringlist.h>
0031 
0032 /**
0033 Connection preferences - contains all settings,
0034 aliases, triggers,
0035 auto-mapper information and so on (most of them are included
0036 in separate objects, but the class is still pretty big)
0037 
0038   *@author Tomas Mecir
0039   */
0040 
0041 class cConnPrefs {
0042 private:
0043 //directory that contains preferences
0044   QString directory;
0045 
0046 //Part 1 - preferences
0047   //basic info
0048   QString _name, _server;
0049   QString _login, _password;
0050   int _port;
0051   QStringList _connstr;
0052   
0053   //type of connection
0054    //NOTHING HERE
0055   //connection parameters
0056   bool _ansicolors;
0057   bool _limittriggers, _limitrepeater;
0058   bool _startupneg;
0059   bool _promptlabel;
0060   bool _lpmudstyle;
0061   bool _statusprompt;
0062   bool _consoleprompt;
0063   bool _autoadvtranscript;
0064     
0065   //auto-mapper settings
0066    //NOTHING HERE YET
0067    
0068   //default movement commands, quit command, ...
0069   enum Direction {North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest, Up, Down};
0070   QString _cmd[10];
0071   QString _cmdquit;
0072 
0073   //default directories
0074   QString scriptdir;
0075   QString defworkdir;
0076   QString transcriptdir;
0077 
0078   //MUD Sound Prococol settings
0079   bool usemsp;
0080   QStringList sounddirs;
0081   /** alwaysmsp - use MSP even if not negotiated
0082   midlinemsp - allow mid-line MSP triggers */
0083   bool alwaysmsp, midlinemsp;
0084 
0085   //MXP settings
0086   int usemxp;
0087   QString varprefix;
0088   
0089 public:
0090   cConnPrefs (QString directory);
0091   ~cConnPrefs ();
0092 
0093 //load/save settings
0094   void load ();
0095   
0096 //functions that get/set variables:
0097 
0098 //Part 1 - preferences
0099   //basic info
0100   void setName (const QString &s) { _name = s; };
0101   const QString name () { return _name; };
0102   void setServer (const QString &s) { _server = s; };
0103   const QString server () { return _server; };
0104   void setLogin (const QString &s) { _login = s; };
0105   const QString login () { return _login; };
0106   void setPassword (const QString &s) { _password = s; };
0107   const QString password () { return _password; };
0108   void setPort (int port);
0109   int port () { return _port; };
0110   QStringList connStr () { return _connstr; };
0111   void setConnStr (QStringList cs) { _connstr = cs; };
0112   
0113   //type of connection
0114    //NOTHING HERE
0115    
0116   //connection parameters
0117   bool ansiColors () { return _ansicolors; };
0118   void setAnsiColors (bool val);
0119   bool limitTriggers () { return _limittriggers; };
0120   bool limitRepeater () { return _limitrepeater; };
0121   void setLimitTriggers (bool val) { _limittriggers = val; };
0122   void setLimitRepeater (bool val) { _limitrepeater = val; };
0123   bool negotiateOnStartup () { return _startupneg; };
0124   void setNegotiateOnStartup (bool val);
0125   bool promptLabel () { return _promptlabel; };
0126   void setPromptLabel (bool val);
0127   bool LPMudStyle () { return _lpmudstyle; };
0128   void setLPMudStyle (bool val);
0129   bool statusPrompt() { return _statusprompt; };
0130   void setStatusPrompt (bool val);
0131   bool consolePrompt() { return _consoleprompt; };
0132   void setConsolePrompt (bool val) { _consoleprompt = val; };
0133   bool autoAdvTranscript() { return _autoadvtranscript; };
0134   void setAutoAdvTranscript (bool val) { _autoadvtranscript = val; };
0135   
0136   //auto-mapper settings
0137    //NOTHING HERE YET
0138    
0139   //default movement commands, quit command, ...
0140   QString cmd (int which) { return ((which >= 0) && (which <= 9)) ? _cmd[which] : (QString)""; };
0141   void setCmd (int which, QString val);
0142   QString quit () { return _cmdquit; };
0143   void setQuit (QString val);
0144   
0145   //script settings
0146   QString scriptDir () { return scriptdir; };
0147   void setScriptDir (const QString &s) { scriptdir = s; };
0148   QString workDir () { return defworkdir; };
0149   void setWorkDir (const QString &s) { defworkdir = s; };
0150   QString transcriptDir () { return transcriptdir; };
0151   void setTranscriptDir (const QString &s) { transcriptdir = s; };
0152          
0153   //MSP settings
0154   QStringList soundDirs () { return sounddirs; };
0155   void setSoundDirs (QStringList dirs) { sounddirs = dirs; };
0156   bool useMSP () { return usemsp; };
0157   void setUseMSP (bool val) { usemsp = val; };
0158   bool alwaysMSP () { return alwaysmsp; };
0159   void setAlwaysMSP (bool val) { alwaysmsp = val; };
0160   bool midlineMSP () { return midlinemsp; };
0161   void setMidlineMSP (bool val) { midlinemsp = val; };
0162 
0163   //MXP settings
0164   int useMXP () { return usemxp; };
0165   void setUseMXP (int val);
0166   QString varPrefix () { return varprefix; };
0167   void setVarPrefix (const QString &prefix) { varprefix = prefix; };
0168 };
0169 
0170 #endif