summaryrefslogtreecommitdiffstats
path: root/ksirc/ksopts.h
blob: 9bd96192f0652640fcb268188203a2d2158ae7b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218

#ifndef _KSOPTS_H_
#define _KSOPTS_H_
#include <tqmap.h>
#include <tqdict.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqcolor.h>
#include <tqfont.h>
#include <tqrect.h>
#include <tqpixmap.h>
#include <tqdatetime.h>

#define IRC_SAFE_MAX_LINE 450

#include "boundscheckingarray.h"
#include "ksircchannel.h"
#include "ksircserver.h"

// Central place to hold KSirc's options
// and manage default values. The base classes
// are only used directly by the prefs dialog.
// The constructors initialize all options with default values.
class KSOGeneral
{
public:
    KSOGeneral();

    enum { SDI, MDI } displayMode;
    bool autoCreateWin : 1;
    bool autoCreateWinForNotice : 1;
    bool nickCompletion : 1;
    bool displayTopic : 1;
    bool oneLineEntry : 1;
    bool runDocked : 1;
//    bool timeStamp : 1;
//    bool beepNotify : 1;
    bool colorPicker : 1;
    bool autoRejoin : 1;
//    bool beepOnMsg : 1;
//    bool logging : 1;
    bool publicAway : 1;
    bool useColourNickList : 1;
    //    bool topicShow : 1;
    bool dockPopups : 1;
    bool autoSaveHistory : 1;
    int windowLength;
    TQString backgroundFile;

    TQPixmap backgroundPixmap();

private:
    TQPixmap m_backgroundPixmap;
};

class KSOChannel
{
public:
    KSOChannel();

    TQString server;
    TQString channel;

    bool timeStamp : 1;
    bool beepNotify : 1;
    bool beepOnMsg : 1;
    bool logging : 1;
    bool topicShow : 1;
    bool filterJoinPart : 1;
    TQString encoding;

    TQDateTime lastUsed;

    static bool applyGlobally;



};

class KSOServer
{
public:
    KSOServer();

    TQString server;
    bool globalCopy;

    TQString nick;
    TQString altNick;
    TQString realName;
    TQString userID;
    TQStringList notifyList;

    TQDateTime lastUsed;
};

class KSOStartup
{
public:
    KSOStartup();

    TQRect geometry;
//    TQString nick;
//    TQString altNick;
//    TQString realName;
//    TQString userID;
//    TQStringList notifyList;
};

class KSOColors
{
public:
    enum { numColors = 16 };

    KSOColors();

    TQColor textColor;
    TQColor linkColor;
    TQColor infoColor;
    TQColor channelColor;
    TQColor errorColor;
    TQColor ownNickColor;
    bool ownNickBold : 1;
    bool ownNickUl : 1;
    bool ownNickRev : 1;

    TQColor msgContainNick; // needs config + impl
    TQColor msg1Contain;    // needs config
    TQString msg1String;    // needs config
    bool   msg1Regex;
    TQColor msg2Contain;    // need config
    TQString msg2String;    // needs config
    bool   msg2Regex;

    TQColor nickForeground;
    TQColor nickBackground;
    TQColor backgroundColor;
    TQColor selBackgroundColor;
    TQColor selForegroundColor;
    //TQColor ircColors[numColors];
    BoundsCheckingArray<TQColor, numColors> ircColors;
    BoundsCheckingArray<bool, numColors> nickHighlight;

    TQString colourTheme;

    TQFont defaultFont;
    bool ksircColors : 1;
    bool mircColors : 1;
    bool nickColourization : 1;

};

class KSORMBMenu
{
public:
    KSORMBMenu();
};

class KSOServChan
{
public:
    KSOServChan();
};

typedef TQMap<TQString, KSOChannel> ChannelOpMap;
typedef TQMap<TQString, ChannelOpMap> ServerChannelOpMap;
typedef TQMap<TQString, KSOServer> ServerOpMap;

class KSOptions
    : public KSOGeneral,
    public KSOStartup,
    public KSOColors,
    public KSORMBMenu,
    public KSOServChan
{
public:
    KSOptions() { s_options = this; }

    void load( int sections = -1 );
    void save( int sections = -1 );

    static KSOptions *options() { return s_options; }

    ServerChannelOpMap channel;
    ServerOpMap server;

    KSOChannel &chan( const KSircChannel &chanInfo )
    {
        return channel[chanInfo.server()][chanInfo.channel()];
    }

    KSOServer &serv( const KSircServer &servInfo )
    {
        return server[servInfo.server()];
    }

    void channelSetup(TQString serv, TQString chan);
    void applyChannelGlobal(void);

    void serverSetup(TQString server);
    void serverSetup( const KSircServer &servInfo )
    {
        serverSetup(servInfo.server());
    }

    enum {
        All = -1, General = 1, Startup = 2,
        Colors = 4, RMBMenu = 8, ServChan = 16,
        Channels = 32, Servers = 64
    };

private:
    static KSOptions *s_options;
};

#define ksopts (KSOptions::options())

#endif