joachim99@8
|
1 /*
|
joachim99@8
|
2 * kdiff3 - Text Diff And Merge Tool
|
joachim99@8
|
3 * This file only: Copyright (C) 2002 Joachim Eibl, joachim.eibl@gmx.de
|
joachim99@8
|
4 *
|
joachim99@8
|
5 * This program is free software; you can redistribute it and/or modify
|
joachim99@8
|
6 * it under the terms of the GNU General Public License as published by
|
joachim99@8
|
7 * the Free Software Foundation; either version 2 of the License, or
|
joachim99@8
|
8 * (at your option) any later version.
|
joachim99@8
|
9 *
|
joachim99@8
|
10 * This program is distributed in the hope that it will be useful,
|
joachim99@8
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
joachim99@8
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
joachim99@8
|
13 * GNU General Public License for more details.
|
joachim99@8
|
14 *
|
joachim99@8
|
15 * You should have received a copy of the GNU General Public License
|
joachim99@8
|
16 * along with this program; if not, write to the Free Software
|
joachim99@8
|
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
joachim99@8
|
18 *
|
joachim99@8
|
19 */
|
joachim99@8
|
20
|
joachim99@8
|
21 /***************************************************************************
|
joachim99@8
|
22 * $Log$
|
joachim99@30
|
23 * Revision 1.2 2003/10/11 13:59:39 joachim99
|
joachim99@30
|
24 * Use Courier New as default font under WIN32
|
joachim99@30
|
25 *
|
joachim99@8
|
26 * Revision 1.1 2003/10/06 18:38:48 joachim99
|
joachim99@8
|
27 * KDiff3 version 0.9.70
|
joachim99@8
|
28 ***************************************************************************/
|
joachim99@8
|
29
|
joachim99@8
|
30 #include <qcheckbox.h>
|
joachim99@8
|
31 #include <qcombobox.h>
|
joachim99@8
|
32 #include <qfont.h>
|
joachim99@8
|
33 #include <qframe.h>
|
joachim99@8
|
34 #include <qlayout.h>
|
joachim99@8
|
35 #include <qlabel.h>
|
joachim99@8
|
36 #include <qlineedit.h>
|
joachim99@8
|
37 #include <qvbox.h>
|
joachim99@8
|
38 #include <qvalidator.h>
|
joachim99@8
|
39 #include <qtooltip.h>
|
joachim99@8
|
40
|
joachim99@8
|
41 #include <kapplication.h>
|
joachim99@8
|
42 #include <kcolorbtn.h>
|
joachim99@8
|
43 #include <kfontdialog.h> // For KFontChooser
|
joachim99@8
|
44 #include <kiconloader.h>
|
joachim99@8
|
45 #include <klocale.h>
|
joachim99@8
|
46 #include <kconfig.h>
|
joachim99@8
|
47 #include <kmessagebox.h>
|
joachim99@8
|
48 //#include <kkeydialog.h>
|
joachim99@8
|
49
|
joachim99@8
|
50 #include "optiondialog.h"
|
joachim99@8
|
51 #include "diff.h"
|
joachim99@8
|
52
|
joachim99@8
|
53 void OptionDialog::addOptionItem(OptionItem* p)
|
joachim99@8
|
54 {
|
joachim99@8
|
55 m_optionItemList.push_back(p);
|
joachim99@8
|
56 }
|
joachim99@8
|
57
|
joachim99@8
|
58 class OptionItem
|
joachim99@8
|
59 {
|
joachim99@8
|
60 public:
|
joachim99@8
|
61 OptionItem( OptionDialog* pOptionDialog, QString saveName )
|
joachim99@8
|
62 {
|
joachim99@8
|
63 assert(pOptionDialog!=0);
|
joachim99@8
|
64 pOptionDialog->addOptionItem( this );
|
joachim99@8
|
65 m_saveName = saveName;
|
joachim99@8
|
66 }
|
joachim99@8
|
67 virtual ~OptionItem(){}
|
joachim99@8
|
68 virtual void setToDefault()=0;
|
joachim99@8
|
69 virtual void setToCurrent()=0;
|
joachim99@8
|
70 virtual void apply()=0;
|
joachim99@8
|
71 virtual void write(KConfig*)=0;
|
joachim99@8
|
72 virtual void read(KConfig*)=0;
|
joachim99@8
|
73 protected:
|
joachim99@8
|
74 QString m_saveName;
|
joachim99@8
|
75 };
|
joachim99@8
|
76
|
joachim99@8
|
77 class OptionCheckBox : public QCheckBox, public OptionItem
|
joachim99@8
|
78 {
|
joachim99@8
|
79 public:
|
joachim99@8
|
80 OptionCheckBox( QString text, bool bDefaultVal, const QString& saveName, bool* pbVar,
|
joachim99@8
|
81 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
82 : QCheckBox( text, pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
83 {
|
joachim99@8
|
84 m_pbVar = pbVar;
|
joachim99@8
|
85 m_bDefaultVal = bDefaultVal;
|
joachim99@8
|
86 }
|
joachim99@8
|
87 void setToDefault(){ setChecked( m_bDefaultVal ); }
|
joachim99@8
|
88 void setToCurrent(){ setChecked( *m_pbVar ); }
|
joachim99@8
|
89 void apply() { *m_pbVar = isChecked(); }
|
joachim99@8
|
90 void write(KConfig* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@8
|
91 void read (KConfig* config){ *m_pbVar = config->readBoolEntry( m_saveName, *m_pbVar ); }
|
joachim99@8
|
92 private:
|
joachim99@8
|
93 OptionCheckBox( const OptionCheckBox& ); // private copy constructor without implementation
|
joachim99@8
|
94 bool* m_pbVar;
|
joachim99@8
|
95 bool m_bDefaultVal;
|
joachim99@8
|
96 };
|
joachim99@8
|
97
|
joachim99@8
|
98 class OptionColorButton : public KColorButton, public OptionItem
|
joachim99@8
|
99 {
|
joachim99@8
|
100 public:
|
joachim99@8
|
101 OptionColorButton( QColor defaultVal, const QString& saveName, QColor* pVar, QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
102 : KColorButton( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
103 {
|
joachim99@8
|
104 m_pVar = pVar;
|
joachim99@8
|
105 m_defaultVal = defaultVal;
|
joachim99@8
|
106 }
|
joachim99@8
|
107 void setToDefault(){ setColor( m_defaultVal ); }
|
joachim99@8
|
108 void setToCurrent(){ setColor( *m_pVar ); }
|
joachim99@8
|
109 void apply() { *m_pVar = color(); }
|
joachim99@8
|
110 void write(KConfig* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@8
|
111 void read (KConfig* config){ *m_pVar = config->readColorEntry( m_saveName, m_pVar ); }
|
joachim99@8
|
112 private:
|
joachim99@8
|
113 OptionColorButton( const OptionColorButton& ); // private copy constructor without implementation
|
joachim99@8
|
114 QColor* m_pVar;
|
joachim99@8
|
115 QColor m_defaultVal;
|
joachim99@8
|
116 };
|
joachim99@8
|
117
|
joachim99@8
|
118 class OptionLineEdit : public QLineEdit, public OptionItem
|
joachim99@8
|
119 {
|
joachim99@8
|
120 public:
|
joachim99@8
|
121 OptionLineEdit( const QString& defaultVal, const QString& saveName, QString* pVar,
|
joachim99@8
|
122 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
123 : QLineEdit( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
124 {
|
joachim99@8
|
125 m_pVar = pVar;
|
joachim99@8
|
126 m_defaultVal = defaultVal;
|
joachim99@8
|
127 }
|
joachim99@8
|
128 void setToDefault(){ setText( m_defaultVal ); }
|
joachim99@8
|
129 void setToCurrent(){ setText( *m_pVar ); }
|
joachim99@8
|
130 void apply() { *m_pVar = text(); }
|
joachim99@8
|
131 void write(KConfig* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@8
|
132 void read (KConfig* config){ *m_pVar = config->readEntry( m_saveName, *m_pVar ); }
|
joachim99@8
|
133 private:
|
joachim99@8
|
134 OptionLineEdit( const OptionLineEdit& ); // private copy constructor without implementation
|
joachim99@8
|
135 QString* m_pVar;
|
joachim99@8
|
136 QString m_defaultVal;
|
joachim99@8
|
137 };
|
joachim99@8
|
138
|
joachim99@8
|
139 #if defined QT_NO_VALIDATOR
|
joachim99@8
|
140 #error No validator
|
joachim99@8
|
141 #endif
|
joachim99@8
|
142 class OptionIntEdit : public QLineEdit, public OptionItem
|
joachim99@8
|
143 {
|
joachim99@8
|
144 public:
|
joachim99@8
|
145 OptionIntEdit( int defaultVal, const QString& saveName, int* pVar, int rangeMin, int rangeMax,
|
joachim99@8
|
146 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
147 : QLineEdit( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
148 {
|
joachim99@8
|
149 m_pVar = pVar;
|
joachim99@8
|
150 m_defaultVal = defaultVal;
|
joachim99@8
|
151 QIntValidator* v = new QIntValidator(this);
|
joachim99@8
|
152 v->setRange( rangeMin, rangeMax );
|
joachim99@8
|
153 setValidator( v );
|
joachim99@8
|
154 }
|
joachim99@8
|
155 void setToDefault(){ QString s; s.setNum(m_defaultVal); setText( s ); }
|
joachim99@8
|
156 void setToCurrent(){ QString s; s.setNum(*m_pVar); setText( s ); }
|
joachim99@8
|
157 void apply() { const QIntValidator* v=static_cast<const QIntValidator*>(validator());
|
joachim99@8
|
158 *m_pVar = minMaxLimiter( text().toInt(), v->bottom(), v->top());
|
joachim99@8
|
159 setText( QString::number(*m_pVar) ); }
|
joachim99@8
|
160 void write(KConfig* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@8
|
161 void read (KConfig* config){ *m_pVar = config->readNumEntry( m_saveName, *m_pVar ); }
|
joachim99@8
|
162 private:
|
joachim99@8
|
163 OptionIntEdit( const OptionIntEdit& ); // private copy constructor without implementation
|
joachim99@8
|
164 int* m_pVar;
|
joachim99@8
|
165 int m_defaultVal;
|
joachim99@8
|
166 };
|
joachim99@8
|
167
|
joachim99@8
|
168
|
joachim99@8
|
169 OptionDialog::OptionDialog( bool bShowDirMergeSettings, QWidget *parent, char *name )
|
joachim99@8
|
170 :KDialogBase( IconList, i18n("Configure"), Help|Default|Apply|Ok|Cancel,
|
joachim99@8
|
171 Ok, parent, name, true /*modal*/, true )
|
joachim99@8
|
172 {
|
joachim99@8
|
173 setHelp( "kdiff3/index.html", QString::null );
|
joachim99@8
|
174
|
joachim99@8
|
175 setupFontPage();
|
joachim99@8
|
176 setupColorPage();
|
joachim99@8
|
177 setupEditPage();
|
joachim99@8
|
178 setupDiffPage();
|
joachim99@8
|
179 if (bShowDirMergeSettings)
|
joachim99@8
|
180 setupDirectoryMergePage();
|
joachim99@8
|
181 //setupKeysPage();
|
joachim99@8
|
182
|
joachim99@8
|
183 // Initialize all values in the dialog
|
joachim99@8
|
184 resetToDefaults();
|
joachim99@8
|
185 slotApply();
|
joachim99@8
|
186 }
|
joachim99@8
|
187
|
joachim99@8
|
188 OptionDialog::~OptionDialog( void )
|
joachim99@8
|
189 {
|
joachim99@8
|
190 }
|
joachim99@8
|
191
|
joachim99@8
|
192
|
joachim99@8
|
193 void OptionDialog::setupFontPage( void )
|
joachim99@8
|
194 {
|
joachim99@8
|
195 QFrame *page = addPage( i18n("Font"), i18n("Editor and diff output font" ),
|
joachim99@8
|
196 BarIcon("fonts", KIcon::SizeMedium ) );
|
joachim99@8
|
197
|
joachim99@8
|
198 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
199
|
joachim99@8
|
200 m_fontChooser = new KFontChooser( page,"font",true/*onlyFixed*/,QStringList(),false,6 );
|
joachim99@8
|
201 topLayout->addWidget( m_fontChooser );
|
joachim99@8
|
202
|
joachim99@8
|
203 QGridLayout *gbox = new QGridLayout( 1, 2 );
|
joachim99@8
|
204 topLayout->addLayout( gbox );
|
joachim99@8
|
205 int line=0;
|
joachim99@8
|
206
|
joachim99@8
|
207 OptionCheckBox* pItalicDeltas = new OptionCheckBox( i18n("Italic Font For Deltas"), false, "ItalicForDeltas", &m_bItalicForDeltas, page, this );
|
joachim99@8
|
208 gbox->addMultiCellWidget( pItalicDeltas, line, line, 0, 1 );
|
joachim99@8
|
209 QToolTip::add( pItalicDeltas, i18n(
|
joachim99@8
|
210 "Selects the italic version of the font for differences.\n"
|
joachim99@8
|
211 "If the font doesn't support italic characters, then this does nothing.")
|
joachim99@8
|
212 );
|
joachim99@8
|
213 }
|
joachim99@8
|
214
|
joachim99@8
|
215
|
joachim99@8
|
216 void OptionDialog::setupColorPage( void )
|
joachim99@8
|
217 {
|
joachim99@8
|
218 QFrame *page = addPage( i18n("Color"), i18n("Colors in editor and diff output"),
|
joachim99@8
|
219 BarIcon("colorize", KIcon::SizeMedium ) );
|
joachim99@8
|
220 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
221
|
joachim99@8
|
222 QGridLayout *gbox = new QGridLayout( 7, 2 );
|
joachim99@8
|
223 topLayout->addLayout(gbox);
|
joachim99@8
|
224
|
joachim99@8
|
225 QLabel* label;
|
joachim99@8
|
226 int line = 0;
|
joachim99@8
|
227
|
joachim99@8
|
228 int depth = QColor::numBitPlanes();
|
joachim99@8
|
229 bool bLowColor = depth<=8;
|
joachim99@8
|
230
|
joachim99@8
|
231 OptionColorButton* pFgColor = new OptionColorButton( black,"FgColor", &m_fgColor, page, this );
|
joachim99@8
|
232 label = new QLabel( pFgColor, i18n("Foreground color:"), page );
|
joachim99@8
|
233 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
234 gbox->addWidget( pFgColor, line, 1 );
|
joachim99@8
|
235 ++line;
|
joachim99@8
|
236
|
joachim99@8
|
237 OptionColorButton* pBgColor = new OptionColorButton( white, "BgColor", &m_bgColor, page, this );
|
joachim99@8
|
238 label = new QLabel( pBgColor, i18n("Background color:"), page );
|
joachim99@8
|
239 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
240 gbox->addWidget( pBgColor, line, 1 );
|
joachim99@8
|
241
|
joachim99@8
|
242 ++line;
|
joachim99@8
|
243
|
joachim99@8
|
244 OptionColorButton* pDiffBgColor = new OptionColorButton( lightGray, "DiffBgColor", &m_diffBgColor, page, this );
|
joachim99@8
|
245 label = new QLabel( pDiffBgColor, i18n("Diff background color:"), page );
|
joachim99@8
|
246 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
247 gbox->addWidget( pDiffBgColor, line, 1 );
|
joachim99@8
|
248 ++line;
|
joachim99@8
|
249
|
joachim99@8
|
250 OptionColorButton* pColorA = new OptionColorButton(
|
joachim99@8
|
251 bLowColor ? qRgb(0,0,255) : qRgb(0,0,200)/*blue*/, "ColorA", &m_colorA, page, this );
|
joachim99@8
|
252 label = new QLabel( pColorA, i18n("Color A:"), page );
|
joachim99@8
|
253 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
254 gbox->addWidget( pColorA, line, 1 );
|
joachim99@8
|
255 ++line;
|
joachim99@8
|
256
|
joachim99@8
|
257 OptionColorButton* pColorB = new OptionColorButton(
|
joachim99@8
|
258 bLowColor ? qRgb(0,128,0) : qRgb(0,150,0)/*green*/, "ColorB", &m_colorB, page, this );
|
joachim99@8
|
259 label = new QLabel( pColorB, i18n("Color B:"), page );
|
joachim99@8
|
260 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
261 gbox->addWidget( pColorB, line, 1 );
|
joachim99@8
|
262 ++line;
|
joachim99@8
|
263
|
joachim99@8
|
264 OptionColorButton* pColorC = new OptionColorButton(
|
joachim99@8
|
265 bLowColor ? qRgb(128,0,128) : qRgb(150,0,150)/*magenta*/, "ColorC", &m_colorC, page, this );
|
joachim99@8
|
266 label = new QLabel( pColorC, i18n("Color C:"), page );
|
joachim99@8
|
267 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
268 gbox->addWidget( pColorC, line, 1 );
|
joachim99@8
|
269 ++line;
|
joachim99@8
|
270
|
joachim99@8
|
271 OptionColorButton* pColorForConflict = new OptionColorButton( red, "ColorForConflict", &m_colorForConflict, page, this );
|
joachim99@8
|
272 label = new QLabel( pColorForConflict, i18n("Conflict Color:"), page );
|
joachim99@8
|
273 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
274 gbox->addWidget( pColorForConflict, line, 1 );
|
joachim99@8
|
275 ++line;
|
joachim99@8
|
276
|
joachim99@8
|
277 OptionColorButton* pColor = new OptionColorButton(
|
joachim99@8
|
278 bLowColor ? qRgb(192,192,192) : qRgb(220,220,100), "CurrentRangeBgColor", &m_currentRangeBgColor, page, this );
|
joachim99@8
|
279 label = new QLabel( pColor, i18n("Current range background color:"), page );
|
joachim99@8
|
280 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
281 gbox->addWidget( pColor, line, 1 );
|
joachim99@8
|
282 ++line;
|
joachim99@8
|
283
|
joachim99@8
|
284 pColor = new OptionColorButton(
|
joachim99@8
|
285 bLowColor ? qRgb(255,255,0) : qRgb(255,255,150), "CurrentRangeDiffBgColor", &m_currentRangeDiffBgColor, page, this );
|
joachim99@8
|
286 label = new QLabel( pColor, i18n("Current range diff background color:"), page );
|
joachim99@8
|
287 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
288 gbox->addWidget( pColor, line, 1 );
|
joachim99@8
|
289 ++line;
|
joachim99@8
|
290
|
joachim99@8
|
291 topLayout->addStretch(10);
|
joachim99@8
|
292 }
|
joachim99@8
|
293
|
joachim99@8
|
294
|
joachim99@8
|
295 void OptionDialog::setupEditPage( void )
|
joachim99@8
|
296 {
|
joachim99@8
|
297 QFrame *page = addPage( i18n("Editor Settings"), i18n("Editor behaviour"),
|
joachim99@8
|
298 BarIcon("edit", KIcon::SizeMedium ) );
|
joachim99@8
|
299 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
300
|
joachim99@8
|
301 QGridLayout *gbox = new QGridLayout( 4, 2 );
|
joachim99@8
|
302 topLayout->addLayout( gbox );
|
joachim99@8
|
303 QLabel* label;
|
joachim99@8
|
304 int line=0;
|
joachim99@8
|
305
|
joachim99@8
|
306 OptionCheckBox* pReplaceTabs = new OptionCheckBox( i18n("Tab inserts spaces"), false, "ReplaceTabs", &m_bReplaceTabs, page, this );
|
joachim99@8
|
307 gbox->addMultiCellWidget( pReplaceTabs, line, line, 0, 1 );
|
joachim99@8
|
308 QToolTip::add( pReplaceTabs, i18n(
|
joachim99@8
|
309 "On: Pressing tab generates the appropriate number of spaces.\n"
|
joachim99@8
|
310 "Off: A Tab-character will be inserted.")
|
joachim99@8
|
311 );
|
joachim99@8
|
312 ++line;
|
joachim99@8
|
313
|
joachim99@8
|
314 OptionIntEdit* pTabSize = new OptionIntEdit( 8, "TabSize", &m_tabSize, 1, 100, page, this );
|
joachim99@8
|
315 label = new QLabel( pTabSize, i18n("Tab size:"), page );
|
joachim99@8
|
316 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
317 gbox->addWidget( pTabSize, line, 1 );
|
joachim99@8
|
318 ++line;
|
joachim99@8
|
319
|
joachim99@8
|
320 OptionCheckBox* pAutoIndentation = new OptionCheckBox( i18n("Auto Indentation"), true, "AutoIndentation", &m_bAutoIndentation, page, this );
|
joachim99@8
|
321 gbox->addMultiCellWidget( pAutoIndentation, line, line, 0, 1 );
|
joachim99@8
|
322 QToolTip::add( pAutoIndentation, i18n(
|
joachim99@8
|
323 "On: The indentation of the previous line is used for a new line.\n"
|
joachim99@8
|
324 ));
|
joachim99@8
|
325 ++line;
|
joachim99@8
|
326
|
joachim99@8
|
327 OptionCheckBox* pAutoCopySelection = new OptionCheckBox( i18n("Auto Copy Selection"), false, "AutoCopySelection", &m_bAutoCopySelection, page, this );
|
joachim99@8
|
328 gbox->addMultiCellWidget( pAutoCopySelection, line, line, 0, 1 );
|
joachim99@8
|
329 QToolTip::add( pAutoCopySelection, i18n(
|
joachim99@8
|
330 "On: Any selection is immediately written to the clipboard.\n"
|
joachim99@8
|
331 "Off: You must explicitely copy e.g. via Ctrl-C."
|
joachim99@8
|
332 ));
|
joachim99@8
|
333 ++line;
|
joachim99@8
|
334
|
joachim99@8
|
335 topLayout->addStretch(10);
|
joachim99@8
|
336 }
|
joachim99@8
|
337
|
joachim99@8
|
338
|
joachim99@8
|
339 void OptionDialog::setupDiffPage( void )
|
joachim99@8
|
340 {
|
joachim99@8
|
341 QFrame *page = addPage( i18n("Diff & Merge Settings"), i18n("Diff & Merge Settings"),
|
joachim99@8
|
342 BarIcon("misc", KIcon::SizeMedium ) );
|
joachim99@8
|
343 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
344
|
joachim99@8
|
345 QGridLayout *gbox = new QGridLayout( 3, 2 );
|
joachim99@8
|
346 topLayout->addLayout( gbox );
|
joachim99@8
|
347 int line=0;
|
joachim99@8
|
348
|
joachim99@8
|
349 OptionCheckBox* pIgnoreWhiteSpace = new OptionCheckBox( i18n("Ignore white space"), true, "IgnoreWhiteSpace", &m_bIgnoreWhiteSpace, page, this );
|
joachim99@8
|
350 gbox->addMultiCellWidget( pIgnoreWhiteSpace, line, line, 0, 1 );
|
joachim99@8
|
351 QToolTip::add( pIgnoreWhiteSpace, i18n(
|
joachim99@8
|
352 "On: Text that differs only in white space will match and\n"
|
joachim99@8
|
353 "be shown on the same line in the different output windows.\n"
|
joachim99@8
|
354 "Off is useful when whitespace is very important.\n"
|
joachim99@8
|
355 "On is good for C/C++ and similar languages." )
|
joachim99@8
|
356 );
|
joachim99@8
|
357 ++line;
|
joachim99@8
|
358
|
joachim99@8
|
359 OptionCheckBox* pPreserveCarriageReturn = new OptionCheckBox( i18n("Preserve Carriage Return"), false, "PreserveCarriageReturn", &m_bPreserveCarriageReturn, page, this );
|
joachim99@8
|
360 gbox->addMultiCellWidget( pPreserveCarriageReturn, line, line, 0, 1 );
|
joachim99@8
|
361 QToolTip::add( pPreserveCarriageReturn,
|
joachim99@8
|
362 "Show carriage return characters '\\r' if they exist.\n"
|
joachim99@8
|
363 "Helps to compare files that were modified under different operating systems."
|
joachim99@8
|
364 );
|
joachim99@8
|
365 ++line;
|
joachim99@8
|
366
|
joachim99@8
|
367 OptionCheckBox* pIgnoreNumbers = new OptionCheckBox( i18n("Ignore Numbers"), false, "IgnoreNumbers", &m_bIgnoreNumbers, page, this );
|
joachim99@8
|
368 gbox->addMultiCellWidget( pIgnoreNumbers, line, line, 0, 1 );
|
joachim99@8
|
369 QToolTip::add( pIgnoreNumbers,
|
joachim99@8
|
370 "Ignore number characters during line matching phase. (Similar to Ignore white space.)\n"
|
joachim99@8
|
371 "Might help to compare files with numeric data."
|
joachim99@8
|
372 );
|
joachim99@8
|
373 ++line;
|
joachim99@8
|
374
|
joachim99@8
|
375 OptionCheckBox* pUpCase = new OptionCheckBox( i18n("Convert to Upper Case"), false, "UpCase", &m_bUpCase, page, this );
|
joachim99@8
|
376 gbox->addMultiCellWidget( pUpCase, line, line, 0, 1 );
|
joachim99@8
|
377 QToolTip::add( pUpCase,
|
joachim99@8
|
378 "Turn all lower case characters to upper case on reading. (e.g.: 'a'->'A')"
|
joachim99@8
|
379 );
|
joachim99@8
|
380 ++line;
|
joachim99@8
|
381
|
joachim99@8
|
382 QLabel* label = new QLabel( i18n("Preprocessor-Command"), page );
|
joachim99@8
|
383 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
384 OptionLineEdit* pLE = new OptionLineEdit( "", "PreProcessorCmd", &m_PreProcessorCmd, page, this );
|
joachim99@8
|
385 gbox->addWidget( pLE, line, 1 );
|
joachim99@8
|
386 QToolTip::add( label, i18n("User defined pre-processing. (See the docs for details.)") );
|
joachim99@8
|
387 ++line;
|
joachim99@8
|
388
|
joachim99@8
|
389 label = new QLabel( i18n("Line-Matching Preprocessor-Command"), page );
|
joachim99@8
|
390 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
391 pLE = new OptionLineEdit( "", "LineMatchingPreProcessorCmd", &m_LineMatchingPreProcessorCmd, page, this );
|
joachim99@8
|
392 gbox->addWidget( pLE, line, 1 );
|
joachim99@8
|
393 QToolTip::add( label, i18n("This pre-processor is only used during line matching.\n(See the docs for details.)") );
|
joachim99@8
|
394 ++line;
|
joachim99@8
|
395
|
joachim99@8
|
396 OptionCheckBox* pUseExternalDiff = new OptionCheckBox( i18n("Use external diff"), true, "UseExternalDiff", &m_bUseExternalDiff, page, this );
|
joachim99@8
|
397 gbox->addMultiCellWidget( pUseExternalDiff, line, line, 0, 1 );
|
joachim99@8
|
398 QToolTip::add( pUseExternalDiff,
|
joachim99@8
|
399 "Since for complicated files the internal algorithm is not so good yet,\n"
|
joachim99@8
|
400 "you probably want to use the normal diff tool as line matcher."
|
joachim99@8
|
401 );
|
joachim99@8
|
402 ++line;
|
joachim99@8
|
403
|
joachim99@8
|
404 OptionCheckBox* pTryHard = new OptionCheckBox( i18n("Try Hard (slow)"), true, "TryHard", &m_bTryHard, page, this );
|
joachim99@8
|
405 gbox->addMultiCellWidget( pTryHard, line, line, 0, 1 );
|
joachim99@8
|
406 QToolTip::add( pTryHard,
|
joachim99@8
|
407 "Enables the --minimal option for the external diff.\n"
|
joachim99@8
|
408 "The analysis of big files will be much slower."
|
joachim99@8
|
409 );
|
joachim99@8
|
410 ++line;
|
joachim99@8
|
411
|
joachim99@8
|
412 OptionCheckBox* pIgnoreTrivialMatches = new OptionCheckBox( i18n("Ignore trivial matches"), true, "IgnoreTrivialMatches", &m_bIgnoreTrivialMatches, page, this );
|
joachim99@8
|
413 gbox->addMultiCellWidget( pIgnoreTrivialMatches, line, line, 0, 1 );
|
joachim99@8
|
414 QToolTip::add( pIgnoreTrivialMatches, i18n(
|
joachim99@8
|
415 "When a difference was found, the algorithm searches for matching lines\n"
|
joachim99@8
|
416 "Short or trivial lines match even when the differences still continue.\n"
|
joachim99@8
|
417 "Ignoring trivial lines avoids this. Good for C/C++ and similar languages." )
|
joachim99@8
|
418 );
|
joachim99@8
|
419 ++line;
|
joachim99@8
|
420
|
joachim99@8
|
421 label = new QLabel( i18n("Max search length"), page );
|
joachim99@8
|
422 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
423 OptionIntEdit* pMaxSearchLength = new OptionIntEdit( 1000, "MaxSearchLength", &m_maxSearchLength, 100, 100000, page, this );
|
joachim99@8
|
424 gbox->addWidget( pMaxSearchLength, line, 1 );
|
joachim99@8
|
425 QToolTip::add( label, i18n(
|
joachim99@8
|
426 "Diff might fail for too small values but might take too long for big values.\n" )
|
joachim99@8
|
427 );
|
joachim99@8
|
428 ++line;
|
joachim99@8
|
429
|
joachim99@8
|
430 connect( pUseExternalDiff, SIGNAL( toggled(bool)), pTryHard, SLOT(setEnabled(bool)));
|
joachim99@8
|
431 connect( pUseExternalDiff, SIGNAL( toggled(bool)), pMaxSearchLength, SLOT(setDisabled(bool)));
|
joachim99@8
|
432
|
joachim99@8
|
433 connect( pUseExternalDiff, SIGNAL( toggled(bool)), label, SLOT(setDisabled(bool)));
|
joachim99@8
|
434 connect( pUseExternalDiff, SIGNAL( toggled(bool)), pIgnoreTrivialMatches, SLOT(setDisabled(bool)));
|
joachim99@8
|
435
|
joachim99@8
|
436 label = new QLabel( i18n("Auto Advance Delay (ms)"), page );
|
joachim99@8
|
437 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
438 OptionIntEdit* pAutoAdvanceDelay = new OptionIntEdit( 500, "AutoAdvanceDelay", &m_autoAdvanceDelay, 0, 2000, page, this );
|
joachim99@8
|
439 gbox->addWidget( pAutoAdvanceDelay, line, 1 );
|
joachim99@8
|
440 QToolTip::add( label,i18n(
|
joachim99@8
|
441 "When in Auto-Advance mode the result of the current selection is shown \n"
|
joachim99@8
|
442 "for the specified time, before jumping to the next conflict. Range: 0-2000 ms")
|
joachim99@8
|
443 );
|
joachim99@8
|
444 ++line;
|
joachim99@8
|
445
|
joachim99@8
|
446 topLayout->addStretch(10);
|
joachim99@8
|
447 }
|
joachim99@8
|
448
|
joachim99@8
|
449 void OptionDialog::setupDirectoryMergePage( void )
|
joachim99@8
|
450 {
|
joachim99@8
|
451 QFrame *page = addPage( i18n("Directory Merge Settings"), i18n("Directory Merge"),
|
joachim99@8
|
452 BarIcon("folder", KIcon::SizeMedium ) );
|
joachim99@8
|
453 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
454
|
joachim99@8
|
455 QGridLayout *gbox = new QGridLayout( 11, 2 );
|
joachim99@8
|
456 topLayout->addLayout( gbox );
|
joachim99@8
|
457 int line=0;
|
joachim99@8
|
458
|
joachim99@8
|
459 OptionCheckBox* pRecursiveDirs = new OptionCheckBox( i18n("Recursive Directories"), true, "RecursiveDirs", &m_bDmRecursiveDirs, page, this );
|
joachim99@8
|
460 gbox->addMultiCellWidget( pRecursiveDirs, line, line, 0, 1 );
|
joachim99@8
|
461 QToolTip::add( pRecursiveDirs, i18n("Whether to analyze subdirectories or not.") );
|
joachim99@8
|
462 ++line;
|
joachim99@8
|
463 QLabel* label = new QLabel( i18n("File Pattern(s)"), page );
|
joachim99@8
|
464 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
465 OptionLineEdit* pFilePattern = new OptionLineEdit( "*", "FilePattern", &m_DmFilePattern, page, this );
|
joachim99@8
|
466 gbox->addWidget( pFilePattern, line, 1 );
|
joachim99@8
|
467 QToolTip::add( label, i18n(
|
joachim99@8
|
468 "Pattern(s) of files to be analyzed. \n"
|
joachim99@8
|
469 "Wildcards: '*' and '?'\n"
|
joachim99@8
|
470 "Several Patterns can be specified by using the separator: ';'"
|
joachim99@8
|
471 ));
|
joachim99@8
|
472 ++line;
|
joachim99@8
|
473
|
joachim99@8
|
474 label = new QLabel( i18n("File-Anti-Pattern(s)"), page );
|
joachim99@8
|
475 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
476 OptionLineEdit* pFileAntiPattern = new OptionLineEdit( "*.orig;*.o", "FileAntiPattern", &m_DmFileAntiPattern, page, this );
|
joachim99@8
|
477 gbox->addWidget( pFileAntiPattern, line, 1 );
|
joachim99@8
|
478 QToolTip::add( label, i18n(
|
joachim99@8
|
479 "Pattern(s) of files to be excluded from analysis. \n"
|
joachim99@8
|
480 "Wildcards: '*' and '?'\n"
|
joachim99@8
|
481 "Several Patterns can be specified by using the separator: ';'"
|
joachim99@8
|
482 ));
|
joachim99@8
|
483 ++line;
|
joachim99@8
|
484
|
joachim99@8
|
485 label = new QLabel( i18n("Dir-Anti-Pattern(s)"), page );
|
joachim99@8
|
486 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
487 OptionLineEdit* pDirAntiPattern = new OptionLineEdit( "CVS;.deps", "DirAntiPattern", &m_DmDirAntiPattern, page, this );
|
joachim99@8
|
488 gbox->addWidget( pDirAntiPattern, line, 1 );
|
joachim99@8
|
489 QToolTip::add( label, i18n(
|
joachim99@8
|
490 "Pattern(s) of directories to be excluded from analysis. \n"
|
joachim99@8
|
491 "Wildcards: '*' and '?'\n"
|
joachim99@8
|
492 "Several Patterns can be specified by using the separator: ';'"
|
joachim99@8
|
493 ));
|
joachim99@8
|
494 ++line;
|
joachim99@8
|
495
|
joachim99@8
|
496 OptionCheckBox* pUseCvsIgnore = new OptionCheckBox( i18n("Use CVS-Ignore"), false, "UseCvsIgnore", &m_bDmUseCvsIgnore, page, this );
|
joachim99@8
|
497 gbox->addMultiCellWidget( pUseCvsIgnore, line, line, 0, 1 );
|
joachim99@8
|
498 QToolTip::add( pUseCvsIgnore, i18n(
|
joachim99@8
|
499 "Extends the antipattern to anything that would be ignored by CVS.\n"
|
joachim99@8
|
500 "Via local \".cvsignore\"-files this can be directory specific."
|
joachim99@8
|
501 ));
|
joachim99@8
|
502 ++line;
|
joachim99@8
|
503
|
joachim99@8
|
504 OptionCheckBox* pFindHidden = new OptionCheckBox( i18n("Find Hidden Files and Directories"), true, "FindHidden", &m_bDmFindHidden, page, this );
|
joachim99@8
|
505 gbox->addMultiCellWidget( pFindHidden, line, line, 0, 1 );
|
joachim99@8
|
506 #ifdef _WIN32
|
joachim99@8
|
507 QToolTip::add( pFindHidden, i18n("Finds files and directories with the hidden attribute.") );
|
joachim99@8
|
508 #else
|
joachim99@8
|
509 QToolTip::add( pFindHidden, i18n("Finds files and directories starting with '.'.") );
|
joachim99@8
|
510 #endif
|
joachim99@8
|
511 ++line;
|
joachim99@8
|
512
|
joachim99@8
|
513 OptionCheckBox* pFollowFileLinks = new OptionCheckBox( i18n("Follow File Links"), false, "FollowFileLinks", &m_bDmFollowFileLinks, page, this );
|
joachim99@8
|
514 gbox->addMultiCellWidget( pFollowFileLinks, line, line, 0, 1 );
|
joachim99@8
|
515 QToolTip::add( pFollowFileLinks, i18n(
|
joachim99@8
|
516 "On: Compare the file the link points to.\n"
|
joachim99@8
|
517 "Off: Compare the links."
|
joachim99@8
|
518 ));
|
joachim99@8
|
519 ++line;
|
joachim99@8
|
520
|
joachim99@8
|
521 OptionCheckBox* pFollowDirLinks = new OptionCheckBox( i18n("Follow Directory Links"), false, "FollowDirLinks", &m_bDmFollowDirLinks, page, this );
|
joachim99@8
|
522 gbox->addMultiCellWidget( pFollowDirLinks, line, line, 0, 1 );
|
joachim99@8
|
523 QToolTip::add( pFollowDirLinks, i18n(
|
joachim99@8
|
524 "On: Compare the directory the link points to.\n"
|
joachim99@8
|
525 "Off: Compare the links."
|
joachim99@8
|
526 ));
|
joachim99@8
|
527 ++line;
|
joachim99@8
|
528
|
joachim99@8
|
529 OptionCheckBox* pShowOnlyDeltas = new OptionCheckBox( i18n("List only deltas"),false,"ListOnlyDeltas", &m_bDmShowOnlyDeltas, page, this );
|
joachim99@8
|
530 gbox->addMultiCellWidget( pShowOnlyDeltas, line, line, 0, 1 );
|
joachim99@8
|
531 QToolTip::add( pShowOnlyDeltas, i18n(
|
joachim99@8
|
532 "Files and directories without change will not appear in the list."));
|
joachim99@8
|
533 ++line;
|
joachim99@8
|
534
|
joachim99@8
|
535 OptionCheckBox* pTrustDate = new OptionCheckBox( i18n("Trust the modification date. (Unsafe)."), false, "TrustDate", &m_bDmTrustDate, page, this );
|
joachim99@8
|
536 gbox->addMultiCellWidget( pTrustDate, line, line, 0, 1 );
|
joachim99@8
|
537 QToolTip::add( pTrustDate, i18n("Assume that files are equal if the modification date and file length are equal.\n"
|
joachim99@8
|
538 "Useful for big directories or slow networks.") );
|
joachim99@8
|
539 ++line;
|
joachim99@8
|
540
|
joachim99@8
|
541 // Some two Dir-options: Affects only the default actions.
|
joachim99@8
|
542 OptionCheckBox* pSyncMode = new OptionCheckBox( i18n("Synchronize Directories."), false,"SyncMode", &m_bDmSyncMode, page, this );
|
joachim99@8
|
543 gbox->addMultiCellWidget( pSyncMode, line, line, 0, 1 );
|
joachim99@8
|
544 QToolTip::add( pSyncMode, i18n(
|
joachim99@8
|
545 "Offers to store files in both directories so that\n"
|
joachim99@8
|
546 "both directories are the same afterwards.\n"
|
joachim99@8
|
547 "Works only when comparing two directories without specifying a destination." ) );
|
joachim99@8
|
548 ++line;
|
joachim99@8
|
549
|
joachim99@8
|
550 OptionCheckBox* pCopyNewer = new OptionCheckBox( i18n("Copy newer instead of merging. (Unsafe)."), false, "CopyNewer", &m_bDmCopyNewer, page, this );
|
joachim99@8
|
551 gbox->addMultiCellWidget( pCopyNewer, line, line, 0, 1 );
|
joachim99@8
|
552 QToolTip::add( pCopyNewer, i18n(
|
joachim99@8
|
553 "Don't look inside, just take the newer file.\n"
|
joachim99@8
|
554 "(Use this only if you know what you are doing!)\n"
|
joachim99@8
|
555 "Only effective when comparing two directories." ) );
|
joachim99@8
|
556 ++line;
|
joachim99@8
|
557
|
joachim99@8
|
558 OptionCheckBox* pCreateBakFiles = new OptionCheckBox( i18n("Backup files (.orig)"), true, "CreateBakFiles", &m_bDmCreateBakFiles, page, this );
|
joachim99@8
|
559 gbox->addMultiCellWidget( pCreateBakFiles, line, line, 0, 1 );
|
joachim99@8
|
560 QToolTip::add( pCreateBakFiles, i18n(
|
joachim99@8
|
561 "When a file would be saved over an old file, then the old file\n"
|
joachim99@8
|
562 "will be renamed with a '.orig'-extension instead of being deleted."));
|
joachim99@8
|
563 ++line;
|
joachim99@8
|
564
|
joachim99@8
|
565 topLayout->addStretch(10);
|
joachim99@8
|
566 }
|
joachim99@8
|
567
|
joachim99@8
|
568 void OptionDialog::setupKeysPage( void )
|
joachim99@8
|
569 {
|
joachim99@8
|
570 //QVBox *page = addVBoxPage( i18n("Keys"), i18n("KeyDialog" ),
|
joachim99@8
|
571 // BarIcon("fonts", KIcon::SizeMedium ) );
|
joachim99@8
|
572
|
joachim99@8
|
573 //QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
574 // new KFontChooser( page,"font",false/*onlyFixed*/,QStringList(),false,6 );
|
joachim99@8
|
575 //m_pKeyDialog=new KKeyDialog( false, 0 );
|
joachim99@8
|
576 //topLayout->addWidget( m_pKeyDialog );
|
joachim99@8
|
577 }
|
joachim99@8
|
578
|
joachim99@8
|
579 void OptionDialog::slotOk( void )
|
joachim99@8
|
580 {
|
joachim99@8
|
581 slotApply();
|
joachim99@8
|
582
|
joachim99@8
|
583 // My system returns variable width fonts even though I
|
joachim99@8
|
584 // disabled this. Even QFont::fixedPitch() doesn't work.
|
joachim99@8
|
585 QFontMetrics fm(m_font);
|
joachim99@8
|
586 if ( fm.width('W')!=fm.width('i') )
|
joachim99@8
|
587 {
|
joachim99@8
|
588 int result = KMessageBox::warningYesNo(this, i18n(
|
joachim99@8
|
589 "You selected a variable width font.\n\n"
|
joachim99@8
|
590 "Because this program doesn't handle variable width fonts\n"
|
joachim99@8
|
591 "correctly, you might experience problems while editing.\n\n"
|
joachim99@8
|
592 "Do you want to continue or do you want to select another font."),
|
joachim99@8
|
593 i18n("Incompatible font."),
|
joachim99@8
|
594 i18n("Continue at my own risk"), i18n("Select another font"));
|
joachim99@8
|
595 if (result==KMessageBox::No)
|
joachim99@8
|
596 return;
|
joachim99@8
|
597 }
|
joachim99@8
|
598
|
joachim99@8
|
599 accept();
|
joachim99@8
|
600 }
|
joachim99@8
|
601
|
joachim99@8
|
602
|
joachim99@8
|
603 /** Copy the values from the widgets to the public variables.*/
|
joachim99@8
|
604 void OptionDialog::slotApply( void )
|
joachim99@8
|
605 {
|
joachim99@8
|
606 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
607 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
608 {
|
joachim99@8
|
609 (*i)->apply();
|
joachim99@8
|
610 }
|
joachim99@8
|
611
|
joachim99@8
|
612 // FontConfigDlg
|
joachim99@8
|
613 m_font = m_fontChooser->font();
|
joachim99@8
|
614
|
joachim99@8
|
615 emit applyClicked();
|
joachim99@8
|
616 }
|
joachim99@8
|
617
|
joachim99@8
|
618 /** Set the default values in the widgets only, while the
|
joachim99@8
|
619 public variables remain unchanged. */
|
joachim99@8
|
620 void OptionDialog::slotDefault()
|
joachim99@8
|
621 {
|
joachim99@8
|
622 int result = KMessageBox::warningContinueCancel(this, i18n("This resets all options. Not only those of the current topic.") );
|
joachim99@8
|
623 if ( result==KMessageBox::Cancel ) return;
|
joachim99@8
|
624 else resetToDefaults();
|
joachim99@8
|
625 }
|
joachim99@8
|
626
|
joachim99@8
|
627 void OptionDialog::resetToDefaults()
|
joachim99@8
|
628 {
|
joachim99@8
|
629 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
630 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
631 {
|
joachim99@8
|
632 (*i)->setToDefault();
|
joachim99@8
|
633 }
|
joachim99@8
|
634
|
joachim99@30
|
635 #ifdef _WIN32
|
joachim99@30
|
636 m_fontChooser->setFont( QFont("Courier New", 10 ), true /*only fixed*/ );
|
joachim99@30
|
637 #else
|
joachim99@8
|
638 m_fontChooser->setFont( QFont("Courier", 10 ), true /*only fixed*/ );
|
joachim99@30
|
639 #endif
|
joachim99@30
|
640
|
joachim99@8
|
641 m_bAutoAdvance = false;
|
joachim99@8
|
642 m_bShowWhiteSpace = true;
|
joachim99@8
|
643 m_bShowLineNumbers = false;
|
joachim99@8
|
644 m_bHorizDiffWindowSplitting = true;
|
joachim99@8
|
645 }
|
joachim99@8
|
646
|
joachim99@8
|
647 /** Initialise the widgets using the values in the public varibles. */
|
joachim99@8
|
648 void OptionDialog::setState()
|
joachim99@8
|
649 {
|
joachim99@8
|
650 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
651 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
652 {
|
joachim99@8
|
653 (*i)->setToCurrent();
|
joachim99@8
|
654 }
|
joachim99@8
|
655
|
joachim99@8
|
656 m_fontChooser->setFont( m_font, true /*only fixed*/ );
|
joachim99@8
|
657 }
|
joachim99@8
|
658
|
joachim99@8
|
659 void OptionDialog::saveOptions( KConfig* config )
|
joachim99@8
|
660 {
|
joachim99@8
|
661 // No i18n()-Translations here!
|
joachim99@8
|
662
|
joachim99@8
|
663 config->setGroup("KDiff3 Options");
|
joachim99@8
|
664
|
joachim99@8
|
665 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
666 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
667 {
|
joachim99@8
|
668 (*i)->write(config);
|
joachim99@8
|
669 }
|
joachim99@8
|
670
|
joachim99@8
|
671 // FontConfigDlg
|
joachim99@8
|
672 config->writeEntry("Font", m_font );
|
joachim99@8
|
673
|
joachim99@8
|
674 config->writeEntry("AutoAdvance", m_bAutoAdvance );
|
joachim99@8
|
675 config->writeEntry("ShowWhiteSpace", m_bShowWhiteSpace );
|
joachim99@8
|
676 config->writeEntry("ShowLineNumbers", m_bShowLineNumbers );
|
joachim99@8
|
677 config->writeEntry("HorizDiffWindowSplitting", m_bHorizDiffWindowSplitting );
|
joachim99@8
|
678
|
joachim99@8
|
679 // Recent files (selectable in the OpenDialog)
|
joachim99@8
|
680 config->writeEntry( "RecentAFiles", m_recentAFiles, '|' );
|
joachim99@8
|
681 config->writeEntry( "RecentBFiles", m_recentBFiles, '|' );
|
joachim99@8
|
682 config->writeEntry( "RecentCFiles", m_recentCFiles, '|' );
|
joachim99@8
|
683 config->writeEntry( "RecentOutputFiles", m_recentOutputFiles, '|' );
|
joachim99@8
|
684 }
|
joachim99@8
|
685
|
joachim99@8
|
686 void OptionDialog::readOptions( KConfig* config )
|
joachim99@8
|
687 {
|
joachim99@8
|
688 // No i18n()-Translations here!
|
joachim99@8
|
689
|
joachim99@8
|
690 config->setGroup("KDiff3 Options");
|
joachim99@8
|
691
|
joachim99@8
|
692 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
693
|
joachim99@8
|
694 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
695 {
|
joachim99@8
|
696 (*i)->read(config);
|
joachim99@8
|
697 }
|
joachim99@8
|
698
|
joachim99@8
|
699 // Use the current values as default settings.
|
joachim99@8
|
700
|
joachim99@8
|
701 // FontConfigDlg
|
joachim99@8
|
702 m_font = config->readFontEntry( "Font", &m_font);
|
joachim99@8
|
703
|
joachim99@8
|
704 // DiffConfigDlg
|
joachim99@8
|
705
|
joachim99@8
|
706 m_bAutoAdvance = config->readBoolEntry("AutoAdvance", m_bAutoAdvance );
|
joachim99@8
|
707 m_bShowWhiteSpace = config->readBoolEntry("ShowWhiteSpace", m_bShowWhiteSpace );
|
joachim99@8
|
708 m_bShowLineNumbers = config->readBoolEntry("ShowLineNumbers", m_bShowLineNumbers );
|
joachim99@8
|
709 m_bHorizDiffWindowSplitting = config->readBoolEntry("HorizDiffWindowSplitting", m_bHorizDiffWindowSplitting);
|
joachim99@8
|
710
|
joachim99@8
|
711 // Recent files (selectable in the OpenDialog)
|
joachim99@8
|
712 m_recentAFiles = config->readListEntry( "RecentAFiles", '|' );
|
joachim99@8
|
713 m_recentBFiles = config->readListEntry( "RecentBFiles", '|' );
|
joachim99@8
|
714 m_recentCFiles = config->readListEntry( "RecentCFiles", '|' );
|
joachim99@8
|
715 m_recentOutputFiles = config->readListEntry( "RecentOutputFiles", '|' );
|
joachim99@8
|
716
|
joachim99@8
|
717 setState();
|
joachim99@8
|
718 }
|
joachim99@8
|
719
|
joachim99@8
|
720 void OptionDialog::slotHelp( void )
|
joachim99@8
|
721 {
|
joachim99@8
|
722 KDialogBase::slotHelp();
|
joachim99@8
|
723 }
|
joachim99@8
|
724
|
joachim99@8
|
725
|
joachim99@8
|
726 #include "optiondialog.moc"
|