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_
21 #include <q3listbox.h>
26 #include <Q3ValueList>
28 #include <kdialogbase.h>
29 #include <kglobalsettings.h>
41 //********* GlobalData ******************************************
51 enum ColorIndex
{ Ctext
=0, Cbackground
=1, CheadingsText
=2, CheadingsBackground
=3, Clinks
=4, CvisitedLinks
=5 };
52 enum FontIndex
{ Ftext
=0, Fheadings
=1 };
58 const QColor
& color(int i
) { return c_olors
[i
]; }
59 const QString
& colorName(int i
) { return c_olorNames
[i
]; }
60 int colorCount() const { return COL_CNT
; }
61 QColor
defaultColor(int i
);
64 QColor
backgroundColor();
65 QColor
headingsTextColor();
66 QColor
headingsBackgroundColor();
68 QColor
visitedLinksColor();
71 const QFont
& font(int i
) { return f_onts
[i
]; }
72 const QString
& fontName(int i
) { return f_ontNames
[i
]; }
73 int fontCount() const { return FNT_CNT
; }
74 QFont
defaultFont(int);
79 QString
encryptStr(const QString
& aStr
);
81 bool defineClipboard
; // define clipboard content on startup?
83 QSize optSize
,setsSize
,matchSize
; // window geometry
85 Q3ValueList
<int> splitterSizes
;
87 KGlobalSettings::Completion queryComboCompletionMode
;
89 QStringList queryHistory
;
90 bool saveHistory
; // save query history to disk on exit?
91 unsigned int maxHistEntrys
, maxBrowseListEntrys
, maxDefinitions
;
94 QString server
; // network client...
95 int port
,timeout
,pipeSize
,idleHold
;
99 QStringList serverDatabases
, databases
, strategies
;
100 Q3PtrList
<QStringList
> databaseSets
;
101 unsigned int currentDatabase
, currentStrategy
;
103 QColor c_olors
[COL_CNT
];
104 QString c_olorNames
[COL_CNT
];
105 QFont f_onts
[FNT_CNT
];
106 QString f_ontNames
[FNT_CNT
];
111 extern GlobalData
*global
;
114 //********* OptionsDialog ******************************************
117 class OptionsDialog
: public KDialogBase
123 OptionsDialog(QWidget
*parent
=0, const char *name
=0);
126 //===================================================================================
128 class DialogListBox
: public Q3ListBox
{
131 // alwaysIgnore==false: enter is ignored when the widget isn't visible/out of focus
132 DialogListBox(bool alwaysIgnore
=false, QWidget
* parent
=0, const char * name
=0);
136 void keyPressEvent( QKeyEvent
*e
);
141 //===================================================================================
143 class ColorListItem
: public Q3ListBoxText
{
146 ColorListItem( const QString
&text
, const QColor
&color
=Qt::black
);
148 const QColor
& color() { return mColor
; }
149 void setColor( const QColor
&color
) { mColor
= color
; }
152 virtual void paint( QPainter
* );
153 virtual int height( const Q3ListBox
* ) const;
154 virtual int width( const Q3ListBox
* ) const;
160 //===================================================================================
162 class FontListItem
: public Q3ListBoxText
{
165 FontListItem( const QString
&name
, const QFont
& );
167 const QFont
& font() { return f_ont
; }
168 void setFont( const QFont
&);
170 virtual void paint( QPainter
* );
171 virtual int width( const Q3ListBox
* ) const;
178 //===================================================================================
182 void optionsChanged();
191 void slotAuthRequiredToggled( bool );
194 void slotColCheckBoxToggled(bool b
);
195 void slotColItemSelected(Q3ListBoxItem
*); // show color dialog for the entry
196 void slotColDefaultBtnClicked();
197 void slotColChangeBtnClicked();
198 void slotColSelectionChanged();
201 void slotFontCheckBoxToggled(bool b
);
202 void slotFontItemSelected(Q3ListBoxItem
*); // show font dialog for the entry
203 void slotFontDefaultBtnClicked();
204 void slotFontChangeBtnClicked();
205 void slotFontSelectionChanged();
210 QLabel
*l_user
, *l_secret
;
211 KLineEdit
*w_server
, *w_user
, *w_secret
, *w_port
;
212 QComboBox
*w_encoding
;
214 KIntSpinBox
*w_idleHold
,*w_timeout
,*w_pipesize
;
217 DialogListBox
*c_List
,
221 QPushButton
*c_olDefBtn
,
227 QRadioButton
*w_layout
[3];
230 QCheckBox
*w_Clipboard
, *w_Savehist
;
231 KIntSpinBox
*w_Maxhist
, *w_Maxbrowse
, *w_MaxDefinitions
;