1 /* -------------------------------------------------------------
3 options.h (part of The KDE Dictionary Client)
5 Copyright (C) 2000-2001 Christian Gebauer <gebauer@kde.org>
7 This file is distributed under the Artistic License.
8 See LICENSE for details.
10 -------------------------------------------------------------
12 GlobalData manages all global data of Kdict
13 DialgoListBox a list box which ignores Enter, usefull for dialogs
14 OptionsDialog the "Preferences" dialog
16 ------------------------------------------------------------- */
18 #ifndef _KDICT_OPTIONS_H_
19 #define _KDICT_OPTIONS_H_
22 #include <kdialogbase.h>
23 #include <kglobalsettings.h>
35 //********* GlobalData ******************************************
45 enum ColorIndex
{ Ctext
=0, Cbackground
=1, CheadingsText
=2, CheadingsBackground
=3, Clinks
=4, CvisitedLinks
=5 };
46 enum FontIndex
{ Ftext
=0, Fheadings
=1 };
52 const QColor
& color(int i
) { return c_olors
[i
]; }
53 const QString
& colorName(int i
) { return c_olorNames
[i
]; }
54 int colorCount() const { return COL_CNT
; }
55 QColor
defaultColor(int i
);
58 QColor
backgroundColor();
59 QColor
headingsTextColor();
60 QColor
headingsBackgroundColor();
62 QColor
visitedLinksColor();
65 const QFont
& font(int i
) { return f_onts
[i
]; }
66 const QString
& fontName(int i
) { return f_ontNames
[i
]; }
67 int fontCount() const { return FNT_CNT
; }
68 QFont
defaultFont(int);
73 QString
encryptStr(const QString
& aStr
);
75 bool defineClipboard
; // define clipboard content on startup?
77 QSize optSize
,setsSize
,matchSize
; // window geometry
79 QValueList
<int> splitterSizes
;
81 KGlobalSettings::Completion queryComboCompletionMode
;
83 QStringList queryHistory
;
84 bool saveHistory
; // save query history to disk on exit?
85 unsigned int maxHistEntrys
, maxBrowseListEntrys
, maxDefinitions
;
88 QString server
; // network client...
89 int port
,timeout
,pipeSize
,idleHold
;
93 QStringList serverDatabases
, databases
, strategies
;
94 QPtrList
<QStringList
> databaseSets
;
95 unsigned int currentDatabase
, currentStrategy
;
97 QColor c_olors
[COL_CNT
];
98 QString c_olorNames
[COL_CNT
];
99 QFont f_onts
[FNT_CNT
];
100 QString f_ontNames
[FNT_CNT
];
105 extern GlobalData
*global
;
108 //********* OptionsDialog ******************************************
111 class OptionsDialog
: public KDialogBase
117 OptionsDialog(QWidget
*parent
=0, const char *name
=0);
120 //===================================================================================
122 class DialogListBox
: public QListBox
{
125 // alwaysIgnore==false: enter is ignored when the widget isn't visible/out of focus
126 DialogListBox(bool alwaysIgnore
=false, QWidget
* parent
=0, const char * name
=0);
130 void keyPressEvent( QKeyEvent
*e
);
135 //===================================================================================
137 class ColorListItem
: public QListBoxText
{
140 ColorListItem( const QString
&text
, const QColor
&color
=Qt::black
);
142 const QColor
& color() { return mColor
; }
143 void setColor( const QColor
&color
) { mColor
= color
; }
146 virtual void paint( QPainter
* );
147 virtual int height( const QListBox
* ) const;
148 virtual int width( const QListBox
* ) const;
154 //===================================================================================
156 class FontListItem
: public QListBoxText
{
159 FontListItem( const QString
&name
, const QFont
& );
161 const QFont
& font() { return f_ont
; }
162 void setFont( const QFont
&);
164 virtual void paint( QPainter
* );
165 virtual int width( const QListBox
* ) const;
172 //===================================================================================
176 void optionsChanged();
185 void slotAuthRequiredToggled( bool );
188 void slotColCheckBoxToggled(bool b
);
189 void slotColItemSelected(QListBoxItem
*); // show color dialog for the entry
190 void slotColDefaultBtnClicked();
191 void slotColChangeBtnClicked();
192 void slotColSelectionChanged();
195 void slotFontCheckBoxToggled(bool b
);
196 void slotFontItemSelected(QListBoxItem
*); // show font dialog for the entry
197 void slotFontDefaultBtnClicked();
198 void slotFontChangeBtnClicked();
199 void slotFontSelectionChanged();
204 QLabel
*l_user
, *l_secret
;
205 KLineEdit
*w_server
, *w_user
, *w_secret
, *w_port
;
206 QComboBox
*w_encoding
;
208 KIntSpinBox
*w_idleHold
,*w_timeout
,*w_pipesize
;
211 DialogListBox
*c_List
,
215 QPushButton
*c_olDefBtn
,
221 QRadioButton
*w_layout
[3];
224 QCheckBox
*w_Clipboard
, *w_Savehist
;
225 KIntSpinBox
*w_Maxhist
, *w_Maxbrowse
, *w_MaxDefinitions
;