joachim99@8
|
1 /*
|
joachim99@8
|
2 * kdiff3 - Text Diff And Merge Tool
|
joachim99@69
|
3 * Copyright (C) 2002-2006 Joachim Eibl, joachim.eibl at 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@69
|
17 * Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.
|
joachim99@8
|
18 *
|
joachim99@8
|
19 */
|
joachim99@8
|
20
|
joachim99@8
|
21 #include <qcheckbox.h>
|
joachim99@8
|
22 #include <qcombobox.h>
|
joachim99@8
|
23 #include <qfont.h>
|
joachim99@8
|
24 #include <qframe.h>
|
joachim99@8
|
25 #include <qlayout.h>
|
joachim99@8
|
26 #include <qlabel.h>
|
joachim99@8
|
27 #include <qlineedit.h>
|
joachim99@8
|
28 #include <qvbox.h>
|
joachim99@8
|
29 #include <qvalidator.h>
|
joachim99@8
|
30 #include <qtooltip.h>
|
joachim99@58
|
31 #include <qtextcodec.h>
|
joachim99@66
|
32 #include <qradiobutton.h>
|
joachim99@66
|
33 #include <qvbuttongroup.h>
|
joachim99@8
|
34
|
joachim99@8
|
35 #include <kapplication.h>
|
joachim99@8
|
36 #include <kcolorbtn.h>
|
joachim99@8
|
37 #include <kfontdialog.h> // For KFontChooser
|
joachim99@8
|
38 #include <kiconloader.h>
|
joachim99@8
|
39 #include <klocale.h>
|
joachim99@8
|
40 #include <kconfig.h>
|
joachim99@8
|
41 #include <kmessagebox.h>
|
joachim99@69
|
42 #include <kmainwindow.h> //For ktoolbar.h
|
joachim99@69
|
43
|
joachim99@8
|
44 //#include <kkeydialog.h>
|
joachim99@58
|
45 #include <map>
|
joachim99@8
|
46
|
joachim99@8
|
47 #include "optiondialog.h"
|
joachim99@8
|
48 #include "diff.h"
|
joachim99@69
|
49 #include "smalldialogs.h"
|
joachim99@69
|
50
|
joachim99@69
|
51 #include <iostream>
|
joachim99@8
|
52
|
joachim99@66
|
53 #ifndef KREPLACEMENTS_H
|
joachim99@66
|
54 #include <kglobalsettings.h>
|
joachim99@66
|
55 #endif
|
joachim99@66
|
56
|
joachim99@69
|
57 static QString s_historyEntryStartRegExpToolTip;
|
joachim99@69
|
58 static QString s_historyEntryStartSortKeyOrderToolTip;
|
joachim99@69
|
59 static QString s_autoMergeRegExpToolTip;
|
joachim99@69
|
60 static QString s_historyStartRegExpToolTip;
|
joachim99@69
|
61
|
joachim99@8
|
62 void OptionDialog::addOptionItem(OptionItem* p)
|
joachim99@8
|
63 {
|
joachim99@8
|
64 m_optionItemList.push_back(p);
|
joachim99@8
|
65 }
|
joachim99@8
|
66
|
joachim99@8
|
67 class OptionItem
|
joachim99@8
|
68 {
|
joachim99@8
|
69 public:
|
joachim99@69
|
70 OptionItem( OptionDialog* pOptionDialog, const QString& saveName )
|
joachim99@8
|
71 {
|
joachim99@8
|
72 assert(pOptionDialog!=0);
|
joachim99@8
|
73 pOptionDialog->addOptionItem( this );
|
joachim99@8
|
74 m_saveName = saveName;
|
joachim99@8
|
75 }
|
joachim99@8
|
76 virtual ~OptionItem(){}
|
joachim99@8
|
77 virtual void setToDefault()=0;
|
joachim99@8
|
78 virtual void setToCurrent()=0;
|
joachim99@8
|
79 virtual void apply()=0;
|
joachim99@69
|
80 virtual void write(ValueMap*)=0;
|
joachim99@69
|
81 virtual void read(ValueMap*)=0;
|
joachim99@69
|
82 QString getSaveName(){return m_saveName;}
|
joachim99@8
|
83 protected:
|
joachim99@8
|
84 QString m_saveName;
|
joachim99@8
|
85 };
|
joachim99@8
|
86
|
joachim99@8
|
87 class OptionCheckBox : public QCheckBox, public OptionItem
|
joachim99@8
|
88 {
|
joachim99@8
|
89 public:
|
joachim99@8
|
90 OptionCheckBox( QString text, bool bDefaultVal, const QString& saveName, bool* pbVar,
|
joachim99@8
|
91 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
92 : QCheckBox( text, pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
93 {
|
joachim99@8
|
94 m_pbVar = pbVar;
|
joachim99@8
|
95 m_bDefaultVal = bDefaultVal;
|
joachim99@8
|
96 }
|
joachim99@8
|
97 void setToDefault(){ setChecked( m_bDefaultVal ); }
|
joachim99@8
|
98 void setToCurrent(){ setChecked( *m_pbVar ); }
|
joachim99@8
|
99 void apply() { *m_pbVar = isChecked(); }
|
joachim99@69
|
100 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@69
|
101 void read (ValueMap* config){ *m_pbVar = config->readBoolEntry( m_saveName, *m_pbVar ); }
|
joachim99@8
|
102 private:
|
joachim99@8
|
103 OptionCheckBox( const OptionCheckBox& ); // private copy constructor without implementation
|
joachim99@8
|
104 bool* m_pbVar;
|
joachim99@8
|
105 bool m_bDefaultVal;
|
joachim99@8
|
106 };
|
joachim99@8
|
107
|
joachim99@66
|
108 class OptionRadioButton : public QRadioButton, public OptionItem
|
joachim99@66
|
109 {
|
joachim99@66
|
110 public:
|
joachim99@66
|
111 OptionRadioButton( QString text, bool bDefaultVal, const QString& saveName, bool* pbVar,
|
joachim99@66
|
112 QWidget* pParent, OptionDialog* pOD )
|
joachim99@66
|
113 : QRadioButton( text, pParent ), OptionItem( pOD, saveName )
|
joachim99@66
|
114 {
|
joachim99@66
|
115 m_pbVar = pbVar;
|
joachim99@66
|
116 m_bDefaultVal = bDefaultVal;
|
joachim99@66
|
117 }
|
joachim99@66
|
118 void setToDefault(){ setChecked( m_bDefaultVal ); }
|
joachim99@66
|
119 void setToCurrent(){ setChecked( *m_pbVar ); }
|
joachim99@66
|
120 void apply() { *m_pbVar = isChecked(); }
|
joachim99@69
|
121 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@69
|
122 void read (ValueMap* config){ *m_pbVar = config->readBoolEntry( m_saveName, *m_pbVar ); }
|
joachim99@66
|
123 private:
|
joachim99@66
|
124 OptionRadioButton( const OptionRadioButton& ); // private copy constructor without implementation
|
joachim99@66
|
125 bool* m_pbVar;
|
joachim99@66
|
126 bool m_bDefaultVal;
|
joachim99@66
|
127 };
|
joachim99@66
|
128
|
joachim99@69
|
129
|
joachim99@69
|
130 template<class T>
|
joachim99@69
|
131 class OptionT : public OptionItem
|
joachim99@51
|
132 {
|
joachim99@51
|
133 public:
|
joachim99@69
|
134 OptionT( const T& defaultVal, const QString& saveName, T* pVar, OptionDialog* pOD )
|
joachim99@51
|
135 : OptionItem( pOD, saveName )
|
joachim99@51
|
136 {
|
joachim99@69
|
137 m_pVar = pVar;
|
joachim99@69
|
138 *m_pVar = defaultVal;
|
joachim99@69
|
139 }
|
joachim99@69
|
140 OptionT( const QString& saveName, T* pVar, OptionDialog* pOD )
|
joachim99@69
|
141 : OptionItem( pOD, saveName )
|
joachim99@69
|
142 {
|
joachim99@69
|
143 m_pVar = pVar;
|
joachim99@51
|
144 }
|
joachim99@51
|
145 void setToDefault(){}
|
joachim99@51
|
146 void setToCurrent(){}
|
joachim99@51
|
147 void apply() {}
|
joachim99@69
|
148 void write(ValueMap* vm){ writeEntry( vm, m_saveName, *m_pVar ); }
|
joachim99@69
|
149 void read (ValueMap* vm){ readEntry ( vm, m_saveName, *m_pVar ); }
|
joachim99@51
|
150 private:
|
joachim99@69
|
151 OptionT( const OptionT& ); // private copy constructor without implementation
|
joachim99@69
|
152 T* m_pVar;
|
joachim99@51
|
153 };
|
joachim99@51
|
154
|
joachim99@69
|
155 template <class T> void writeEntry(ValueMap* vm, const QString& saveName, const T& v ) { vm->writeEntry( saveName, v ); }
|
joachim99@69
|
156 static void writeEntry(ValueMap* vm, const QString& saveName, const QStringList& v ) { vm->writeEntry( saveName, v, '|' ); }
|
joachim99@69
|
157
|
joachim99@69
|
158 static void readEntry(ValueMap* vm, const QString& saveName, bool& v ) { v = vm->readBoolEntry( saveName, v ); }
|
joachim99@69
|
159 static void readEntry(ValueMap* vm, const QString& saveName, int& v ) { v = vm->readNumEntry( saveName, v ); }
|
joachim99@69
|
160 static void readEntry(ValueMap* vm, const QString& saveName, QSize& v ) { v = vm->readSizeEntry( saveName, &v ); }
|
joachim99@69
|
161 static void readEntry(ValueMap* vm, const QString& saveName, QPoint& v ) { v = vm->readPointEntry( saveName, &v ); }
|
joachim99@69
|
162 static void readEntry(ValueMap* vm, const QString& saveName, QStringList& v ){ v = vm->readListEntry( saveName, QStringList(), '|' ); }
|
joachim99@69
|
163
|
joachim99@69
|
164 typedef OptionT<bool> OptionToggleAction;
|
joachim99@69
|
165 typedef OptionT<int> OptionNum;
|
joachim99@69
|
166 typedef OptionT<QPoint> OptionPoint;
|
joachim99@69
|
167 typedef OptionT<QSize> OptionSize;
|
joachim99@69
|
168 typedef OptionT<QStringList> OptionStringList;
|
joachim99@69
|
169
|
joachim99@69
|
170 class OptionFontChooser : public KFontChooser, public OptionItem
|
joachim99@69
|
171 {
|
joachim99@69
|
172 public:
|
joachim99@69
|
173 OptionFontChooser( const QFont& defaultVal, const QString& saveName, QFont* pbVar, QWidget* pParent, OptionDialog* pOD )
|
joachim99@69
|
174 :KFontChooser( pParent,"font",true/*onlyFixed*/,QStringList(),false,6 ),
|
joachim99@69
|
175 OptionItem( pOD, saveName )
|
joachim99@69
|
176 {
|
joachim99@69
|
177 m_pbVar = pbVar;
|
joachim99@69
|
178 *m_pbVar = defaultVal;
|
joachim99@69
|
179 m_default = defaultVal;
|
joachim99@69
|
180 }
|
joachim99@69
|
181 void setToDefault(){ setFont( m_default, true /*only fixed*/ ); }
|
joachim99@69
|
182 void setToCurrent(){ setFont( *m_pbVar, true /*only fixed*/ ); }
|
joachim99@69
|
183 void apply() { *m_pbVar = font();}
|
joachim99@69
|
184 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@69
|
185 void read (ValueMap* config){ *m_pbVar = config->readFontEntry( m_saveName, m_pbVar ); }
|
joachim99@69
|
186 private:
|
joachim99@69
|
187 OptionFontChooser( const OptionToggleAction& ); // private copy constructor without implementation
|
joachim99@69
|
188 QFont* m_pbVar;
|
joachim99@69
|
189 QFont m_default;
|
joachim99@69
|
190 };
|
joachim99@51
|
191
|
joachim99@8
|
192 class OptionColorButton : public KColorButton, public OptionItem
|
joachim99@8
|
193 {
|
joachim99@8
|
194 public:
|
joachim99@8
|
195 OptionColorButton( QColor defaultVal, const QString& saveName, QColor* pVar, QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
196 : KColorButton( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
197 {
|
joachim99@8
|
198 m_pVar = pVar;
|
joachim99@8
|
199 m_defaultVal = defaultVal;
|
joachim99@8
|
200 }
|
joachim99@8
|
201 void setToDefault(){ setColor( m_defaultVal ); }
|
joachim99@8
|
202 void setToCurrent(){ setColor( *m_pVar ); }
|
joachim99@8
|
203 void apply() { *m_pVar = color(); }
|
joachim99@69
|
204 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@69
|
205 void read (ValueMap* config){ *m_pVar = config->readColorEntry( m_saveName, m_pVar ); }
|
joachim99@8
|
206 private:
|
joachim99@8
|
207 OptionColorButton( const OptionColorButton& ); // private copy constructor without implementation
|
joachim99@8
|
208 QColor* m_pVar;
|
joachim99@8
|
209 QColor m_defaultVal;
|
joachim99@8
|
210 };
|
joachim99@8
|
211
|
joachim99@58
|
212 class OptionLineEdit : public QComboBox, public OptionItem
|
joachim99@8
|
213 {
|
joachim99@8
|
214 public:
|
joachim99@8
|
215 OptionLineEdit( const QString& defaultVal, const QString& saveName, QString* pVar,
|
joachim99@8
|
216 QWidget* pParent, OptionDialog* pOD )
|
joachim99@58
|
217 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
218 {
|
joachim99@69
|
219 setMinimumWidth(50);
|
joachim99@69
|
220 setEditable(true);
|
joachim99@8
|
221 m_pVar = pVar;
|
joachim99@8
|
222 m_defaultVal = defaultVal;
|
joachim99@58
|
223 m_list.push_back(defaultVal);
|
joachim99@69
|
224 insertText();
|
joachim99@8
|
225 }
|
joachim99@69
|
226 void setToDefault(){ setCurrentText( m_defaultVal ); }
|
joachim99@69
|
227 void setToCurrent(){ setCurrentText( *m_pVar ); }
|
joachim99@58
|
228 void apply() { *m_pVar = currentText(); insertText(); }
|
joachim99@69
|
229 void write(ValueMap* config){ config->writeEntry( m_saveName, m_list, '|' ); }
|
joachim99@69
|
230 void read (ValueMap* config){
|
joachim99@69
|
231 m_list = config->readListEntry( m_saveName, m_defaultVal, '|' );
|
joachim99@69
|
232 if ( !m_list.empty() ) *m_pVar = m_list.front();
|
joachim99@58
|
233 clear();
|
joachim99@58
|
234 insertStringList(m_list);
|
joachim99@58
|
235 }
|
joachim99@8
|
236 private:
|
joachim99@58
|
237 void insertText()
|
joachim99@69
|
238 { // Check if the text exists. If yes remove it and push it in as first element
|
joachim99@58
|
239 QString current = currentText();
|
joachim99@58
|
240 m_list.remove( current );
|
joachim99@58
|
241 m_list.push_front( current );
|
joachim99@58
|
242 clear();
|
joachim99@69
|
243 if ( m_list.size()>10 )
|
joachim99@69
|
244 m_list.erase( m_list.at(10),m_list.end() );
|
joachim99@58
|
245 insertStringList(m_list);
|
joachim99@58
|
246 }
|
joachim99@8
|
247 OptionLineEdit( const OptionLineEdit& ); // private copy constructor without implementation
|
joachim99@8
|
248 QString* m_pVar;
|
joachim99@8
|
249 QString m_defaultVal;
|
joachim99@58
|
250 QStringList m_list;
|
joachim99@8
|
251 };
|
joachim99@8
|
252
|
joachim99@8
|
253 #if defined QT_NO_VALIDATOR
|
joachim99@8
|
254 #error No validator
|
joachim99@8
|
255 #endif
|
joachim99@8
|
256 class OptionIntEdit : public QLineEdit, public OptionItem
|
joachim99@8
|
257 {
|
joachim99@8
|
258 public:
|
joachim99@8
|
259 OptionIntEdit( int defaultVal, const QString& saveName, int* pVar, int rangeMin, int rangeMax,
|
joachim99@8
|
260 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
261 : QLineEdit( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
262 {
|
joachim99@8
|
263 m_pVar = pVar;
|
joachim99@8
|
264 m_defaultVal = defaultVal;
|
joachim99@51
|
265 QIntValidator* v = new QIntValidator(this);
|
joachim99@8
|
266 v->setRange( rangeMin, rangeMax );
|
joachim99@8
|
267 setValidator( v );
|
joachim99@8
|
268 }
|
joachim99@8
|
269 void setToDefault(){ QString s; s.setNum(m_defaultVal); setText( s ); }
|
joachim99@8
|
270 void setToCurrent(){ QString s; s.setNum(*m_pVar); setText( s ); }
|
joachim99@8
|
271 void apply() { const QIntValidator* v=static_cast<const QIntValidator*>(validator());
|
joachim99@8
|
272 *m_pVar = minMaxLimiter( text().toInt(), v->bottom(), v->top());
|
joachim99@8
|
273 setText( QString::number(*m_pVar) ); }
|
joachim99@69
|
274 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@69
|
275 void read (ValueMap* config){ *m_pVar = config->readNumEntry( m_saveName, *m_pVar ); }
|
joachim99@8
|
276 private:
|
joachim99@8
|
277 OptionIntEdit( const OptionIntEdit& ); // private copy constructor without implementation
|
joachim99@8
|
278 int* m_pVar;
|
joachim99@8
|
279 int m_defaultVal;
|
joachim99@8
|
280 };
|
joachim99@8
|
281
|
joachim99@51
|
282 class OptionComboBox : public QComboBox, public OptionItem
|
joachim99@51
|
283 {
|
joachim99@51
|
284 public:
|
joachim99@58
|
285 OptionComboBox( int defaultVal, const QString& saveName, int* pVarNum,
|
joachim99@51
|
286 QWidget* pParent, OptionDialog* pOD )
|
joachim99@51
|
287 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@51
|
288 {
|
joachim99@69
|
289 setMinimumWidth(50);
|
joachim99@58
|
290 m_pVarNum = pVarNum;
|
joachim99@58
|
291 m_pVarStr = 0;
|
joachim99@51
|
292 m_defaultVal = defaultVal;
|
joachim99@51
|
293 setEditable(false);
|
joachim99@51
|
294 }
|
joachim99@58
|
295 OptionComboBox( int defaultVal, const QString& saveName, QString* pVarStr,
|
joachim99@58
|
296 QWidget* pParent, OptionDialog* pOD )
|
joachim99@58
|
297 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@58
|
298 {
|
joachim99@58
|
299 m_pVarNum = 0;
|
joachim99@58
|
300 m_pVarStr = pVarStr;
|
joachim99@58
|
301 m_defaultVal = defaultVal;
|
joachim99@58
|
302 setEditable(false);
|
joachim99@58
|
303 }
|
joachim99@58
|
304 void setToDefault()
|
joachim99@58
|
305 {
|
joachim99@58
|
306 setCurrentItem( m_defaultVal );
|
joachim99@58
|
307 if (m_pVarStr!=0){ *m_pVarStr=currentText(); }
|
joachim99@58
|
308 }
|
joachim99@58
|
309 void setToCurrent()
|
joachim99@58
|
310 {
|
joachim99@58
|
311 if (m_pVarNum!=0) setCurrentItem( *m_pVarNum );
|
joachim99@58
|
312 else setText( *m_pVarStr );
|
joachim99@58
|
313 }
|
joachim99@69
|
314 void apply()
|
joachim99@58
|
315 {
|
joachim99@58
|
316 if (m_pVarNum!=0){ *m_pVarNum = currentItem(); }
|
joachim99@58
|
317 else { *m_pVarStr = currentText(); }
|
joachim99@58
|
318 }
|
joachim99@69
|
319 void write(ValueMap* config)
|
joachim99@58
|
320 {
|
joachim99@58
|
321 if (m_pVarStr!=0) config->writeEntry(m_saveName, *m_pVarStr );
|
joachim99@58
|
322 else config->writeEntry(m_saveName, *m_pVarNum );
|
joachim99@58
|
323 }
|
joachim99@69
|
324 void read (ValueMap* config)
|
joachim99@58
|
325 {
|
joachim99@58
|
326 if (m_pVarStr!=0) setText( config->readEntry( m_saveName, currentText() ) );
|
joachim99@58
|
327 else *m_pVarNum = config->readNumEntry( m_saveName, *m_pVarNum );
|
joachim99@58
|
328 }
|
joachim99@51
|
329 private:
|
joachim99@51
|
330 OptionComboBox( const OptionIntEdit& ); // private copy constructor without implementation
|
joachim99@58
|
331 int* m_pVarNum;
|
joachim99@58
|
332 QString* m_pVarStr;
|
joachim99@51
|
333 int m_defaultVal;
|
joachim99@58
|
334
|
joachim99@58
|
335 void setText(const QString& s)
|
joachim99@58
|
336 {
|
joachim99@58
|
337 // Find the string in the combobox-list, don't change the value if nothing fits.
|
joachim99@58
|
338 for( int i=0; i<count(); ++i )
|
joachim99@58
|
339 {
|
joachim99@58
|
340 if ( text(i)==s )
|
joachim99@58
|
341 {
|
joachim99@58
|
342 if (m_pVarNum!=0) *m_pVarNum = i;
|
joachim99@58
|
343 if (m_pVarStr!=0) *m_pVarStr = s;
|
joachim99@58
|
344 setCurrentItem(i);
|
joachim99@58
|
345 return;
|
joachim99@58
|
346 }
|
joachim99@58
|
347 }
|
joachim99@58
|
348 }
|
joachim99@51
|
349 };
|
joachim99@8
|
350
|
joachim99@68
|
351 class OptionEncodingComboBox : public QComboBox, public OptionItem
|
joachim99@68
|
352 {
|
joachim99@68
|
353 std::vector<QTextCodec*> m_codecVec;
|
joachim99@68
|
354 QTextCodec** m_ppVarCodec;
|
joachim99@68
|
355 public:
|
joachim99@68
|
356 OptionEncodingComboBox( const QString& saveName, QTextCodec** ppVarCodec,
|
joachim99@68
|
357 QWidget* pParent, OptionDialog* pOD )
|
joachim99@68
|
358 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@68
|
359 {
|
joachim99@68
|
360 m_ppVarCodec = ppVarCodec;
|
joachim99@68
|
361 insertCodec( i18n("Unicode, 8 bit"), QTextCodec::codecForName("UTF-8") );
|
joachim99@68
|
362 insertCodec( i18n("Unicode"), QTextCodec::codecForName("iso-10646-UCS-2") );
|
joachim99@68
|
363 insertCodec( i18n("Latin1"), QTextCodec::codecForName("iso 8859-1") );
|
joachim99@68
|
364
|
joachim99@68
|
365 // First sort codec names:
|
joachim99@68
|
366 std::map<QString, QTextCodec*> names;
|
joachim99@68
|
367 int i;
|
joachim99@68
|
368 for(i=0;;++i)
|
joachim99@68
|
369 {
|
joachim99@68
|
370 QTextCodec* c = QTextCodec::codecForIndex(i);
|
joachim99@68
|
371 if ( c==0 ) break;
|
joachim99@68
|
372 else names[QString(c->name()).upper()]=c;
|
joachim99@68
|
373 }
|
joachim99@68
|
374
|
joachim99@68
|
375 std::map<QString, QTextCodec*>::iterator it;
|
joachim99@68
|
376 for(it=names.begin();it!=names.end();++it)
|
joachim99@68
|
377 {
|
joachim99@68
|
378 insertCodec( "", it->second );
|
joachim99@68
|
379 }
|
joachim99@68
|
380
|
joachim99@68
|
381 QToolTip::add( this, i18n(
|
joachim99@68
|
382 "Change this if non-ASCII characters are not displayed correctly."
|
joachim99@68
|
383 ));
|
joachim99@68
|
384 }
|
joachim99@68
|
385 void insertCodec( const QString& visibleCodecName, QTextCodec* c )
|
joachim99@68
|
386 {
|
joachim99@68
|
387 if (c!=0)
|
joachim99@68
|
388 {
|
joachim99@68
|
389 for( unsigned int i=0; i<m_codecVec.size(); ++i )
|
joachim99@68
|
390 {
|
joachim99@68
|
391 if ( c==m_codecVec[i] )
|
joachim99@68
|
392 return; // don't insert any codec twice
|
joachim99@68
|
393 }
|
joachim99@68
|
394 insertItem( visibleCodecName.isEmpty() ? QString(c->name()) : visibleCodecName+" ("+c->name()+")", m_codecVec.size() );
|
joachim99@68
|
395 m_codecVec.push_back( c );
|
joachim99@68
|
396 }
|
joachim99@68
|
397 }
|
joachim99@68
|
398 void setToDefault()
|
joachim99@69
|
399 {
|
joachim99@69
|
400 QString defaultName = QTextCodec::codecForLocale()->name();
|
joachim99@69
|
401 for(int i=0;i<count();++i)
|
joachim99@69
|
402 {
|
joachim99@69
|
403 if (defaultName==text(i) &&
|
joachim99@69
|
404 m_codecVec[i]==QTextCodec::codecForLocale())
|
joachim99@69
|
405 {
|
joachim99@69
|
406 setCurrentItem(i);
|
joachim99@69
|
407 if (m_ppVarCodec!=0){ *m_ppVarCodec=m_codecVec[i]; }
|
joachim99@69
|
408 return;
|
joachim99@69
|
409 }
|
joachim99@69
|
410 }
|
joachim99@69
|
411
|
joachim99@69
|
412 setCurrentItem( 0 );
|
joachim99@69
|
413 if (m_ppVarCodec!=0){ *m_ppVarCodec=m_codecVec[0]; }
|
joachim99@68
|
414 }
|
joachim99@68
|
415 void setToCurrent()
|
joachim99@68
|
416 {
|
joachim99@68
|
417 if (m_ppVarCodec!=0)
|
joachim99@68
|
418 {
|
joachim99@68
|
419 for(unsigned int i=0; i<m_codecVec.size(); ++i)
|
joachim99@68
|
420 {
|
joachim99@68
|
421 if ( *m_ppVarCodec==m_codecVec[i] )
|
joachim99@68
|
422 {
|
joachim99@68
|
423 setCurrentItem( i );
|
joachim99@68
|
424 break;
|
joachim99@68
|
425 }
|
joachim99@68
|
426 }
|
joachim99@68
|
427 }
|
joachim99@68
|
428 }
|
joachim99@68
|
429 void apply()
|
joachim99@68
|
430 {
|
joachim99@68
|
431 if (m_ppVarCodec!=0){ *m_ppVarCodec = m_codecVec[ currentItem() ]; }
|
joachim99@68
|
432 }
|
joachim99@69
|
433 void write(ValueMap* config)
|
joachim99@68
|
434 {
|
joachim99@68
|
435 if (m_ppVarCodec!=0) config->writeEntry(m_saveName, (*m_ppVarCodec)->name() );
|
joachim99@68
|
436 }
|
joachim99@69
|
437 void read (ValueMap* config)
|
joachim99@68
|
438 {
|
joachim99@68
|
439 QString codecName = config->readEntry( m_saveName, m_codecVec[ currentItem() ]->name() );
|
joachim99@68
|
440 for(unsigned int i=0; i<m_codecVec.size(); ++i)
|
joachim99@68
|
441 {
|
joachim99@68
|
442 if ( codecName == m_codecVec[i]->name() )
|
joachim99@68
|
443 {
|
joachim99@68
|
444 setCurrentItem( i );
|
joachim99@68
|
445 if (m_ppVarCodec!=0) *m_ppVarCodec = m_codecVec[i];
|
joachim99@68
|
446 break;
|
joachim99@68
|
447 }
|
joachim99@68
|
448 }
|
joachim99@68
|
449 }
|
joachim99@68
|
450 };
|
joachim99@68
|
451
|
joachim99@68
|
452
|
joachim99@8
|
453 OptionDialog::OptionDialog( bool bShowDirMergeSettings, QWidget *parent, char *name )
|
joachim99@8
|
454 :KDialogBase( IconList, i18n("Configure"), Help|Default|Apply|Ok|Cancel,
|
joachim99@8
|
455 Ok, parent, name, true /*modal*/, true )
|
joachim99@8
|
456 {
|
joachim99@68
|
457 setHelp( "kdiff3/index.html", QString::null );
|
joachim99@8
|
458
|
joachim99@68
|
459 setupFontPage();
|
joachim99@68
|
460 setupColorPage();
|
joachim99@68
|
461 setupEditPage();
|
joachim99@68
|
462 setupDiffPage();
|
joachim99@68
|
463 setupOtherOptions();
|
joachim99@68
|
464 if (bShowDirMergeSettings)
|
joachim99@68
|
465 setupDirectoryMergePage();
|
joachim99@58
|
466
|
joachim99@68
|
467 setupRegionalPage();
|
joachim99@69
|
468 setupIntegrationPage();
|
joachim99@8
|
469
|
joachim99@68
|
470 //setupKeysPage();
|
joachim99@68
|
471
|
joachim99@68
|
472 // Initialize all values in the dialog
|
joachim99@68
|
473 resetToDefaults();
|
joachim99@68
|
474 slotApply();
|
joachim99@8
|
475 }
|
joachim99@8
|
476
|
joachim99@8
|
477 OptionDialog::~OptionDialog( void )
|
joachim99@8
|
478 {
|
joachim99@8
|
479 }
|
joachim99@8
|
480
|
joachim99@51
|
481 void OptionDialog::setupOtherOptions()
|
joachim99@51
|
482 {
|
joachim99@51
|
483 new OptionToggleAction( false, "AutoAdvance", &m_bAutoAdvance, this );
|
joachim99@51
|
484 new OptionToggleAction( true, "ShowWhiteSpaceCharacters", &m_bShowWhiteSpaceCharacters, this );
|
joachim99@51
|
485 new OptionToggleAction( true, "ShowWhiteSpace", &m_bShowWhiteSpace, this );
|
joachim99@51
|
486 new OptionToggleAction( false, "ShowLineNumbers", &m_bShowLineNumbers, this );
|
joachim99@51
|
487 new OptionToggleAction( true, "HorizDiffWindowSplitting", &m_bHorizDiffWindowSplitting, this );
|
joachim99@66
|
488 new OptionToggleAction( false, "WordWrap", &m_bWordWrap, this );
|
joachim99@69
|
489
|
joachim99@69
|
490 new OptionToggleAction( true, "ShowIdenticalFiles", &m_bDmShowIdenticalFiles, this );
|
joachim99@69
|
491
|
joachim99@69
|
492 new OptionToggleAction( true, "Show Toolbar", &m_bShowToolBar, this );
|
joachim99@69
|
493 new OptionToggleAction( true, "Show Statusbar", &m_bShowStatusBar, this );
|
joachim99@69
|
494
|
joachim99@69
|
495 new OptionNum( (int)KToolBar::Top, "ToolBarPos", &m_toolBarPos, this );
|
joachim99@69
|
496 new OptionSize( QSize(600,400),"Geometry", &m_geometry, this );
|
joachim99@69
|
497 new OptionPoint( QPoint(0,22), "Position", &m_position, this );
|
joachim99@69
|
498
|
joachim99@69
|
499 new OptionStringList( "RecentAFiles", &m_recentAFiles, this );
|
joachim99@69
|
500 new OptionStringList( "RecentBFiles", &m_recentBFiles, this );
|
joachim99@69
|
501 new OptionStringList( "RecentCFiles", &m_recentCFiles, this );
|
joachim99@69
|
502 new OptionStringList( "RecentOutputFiles", &m_recentOutputFiles, this );
|
joachim99@51
|
503 }
|
joachim99@8
|
504
|
joachim99@8
|
505 void OptionDialog::setupFontPage( void )
|
joachim99@8
|
506 {
|
joachim99@51
|
507 QFrame *page = addPage( i18n("Font"), i18n("Editor & Diff Output Font" ),
|
joachim99@8
|
508 BarIcon("fonts", KIcon::SizeMedium ) );
|
joachim99@8
|
509
|
joachim99@69
|
510 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@51
|
511
|
joachim99@69
|
512 QFont defaultFont =
|
joachim99@69
|
513 #ifdef _WIN32
|
joachim99@69
|
514 QFont("Courier New", 10 );
|
joachim99@69
|
515 #elif defined( KREPLACEMENTS_H )
|
joachim99@69
|
516 QFont("Courier", 10 );
|
joachim99@69
|
517 #else
|
joachim99@69
|
518 KGlobalSettings::fixedFont();
|
joachim99@69
|
519 #endif
|
joachim99@69
|
520
|
joachim99@69
|
521 OptionFontChooser* pFontChooser = new OptionFontChooser( defaultFont, "Font", &m_font, page, this );
|
joachim99@69
|
522 topLayout->addWidget( pFontChooser );
|
joachim99@8
|
523
|
joachim99@8
|
524 QGridLayout *gbox = new QGridLayout( 1, 2 );
|
joachim99@8
|
525 topLayout->addLayout( gbox );
|
joachim99@8
|
526 int line=0;
|
joachim99@8
|
527
|
joachim99@51
|
528 OptionCheckBox* pItalicDeltas = new OptionCheckBox( i18n("Italic font for deltas"), false, "ItalicForDeltas", &m_bItalicForDeltas, page, this );
|
joachim99@8
|
529 gbox->addMultiCellWidget( pItalicDeltas, line, line, 0, 1 );
|
joachim99@8
|
530 QToolTip::add( pItalicDeltas, i18n(
|
joachim99@8
|
531 "Selects the italic version of the font for differences.\n"
|
joachim99@8
|
532 "If the font doesn't support italic characters, then this does nothing.")
|
joachim99@8
|
533 );
|
joachim99@8
|
534 }
|
joachim99@8
|
535
|
joachim99@8
|
536
|
joachim99@8
|
537 void OptionDialog::setupColorPage( void )
|
joachim99@8
|
538 {
|
joachim99@69
|
539 QFrame *page = addPage( i18n("Color"), i18n("Colors Settings"),
|
joachim99@8
|
540 BarIcon("colorize", KIcon::SizeMedium ) );
|
joachim99@69
|
541 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
542
|
joachim99@8
|
543 QGridLayout *gbox = new QGridLayout( 7, 2 );
|
joachim99@69
|
544 gbox->setColStretch(1,5);
|
joachim99@8
|
545 topLayout->addLayout(gbox);
|
joachim99@8
|
546
|
joachim99@8
|
547 QLabel* label;
|
joachim99@8
|
548 int line = 0;
|
joachim99@8
|
549
|
joachim99@8
|
550 int depth = QColor::numBitPlanes();
|
joachim99@8
|
551 bool bLowColor = depth<=8;
|
joachim99@8
|
552
|
joachim99@69
|
553 label = new QLabel( i18n("Editor and Diff Views:"), page );
|
joachim99@69
|
554 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
555 QFont f( label->font() );
|
joachim99@69
|
556 f.setBold(true);
|
joachim99@69
|
557 label->setFont(f);
|
joachim99@69
|
558 ++line;
|
joachim99@69
|
559
|
joachim99@69
|
560 OptionColorButton* pFgColor = new OptionColorButton( Qt::black,"FgColor", &m_fgColor, page, this );
|
joachim99@8
|
561 label = new QLabel( pFgColor, i18n("Foreground color:"), page );
|
joachim99@8
|
562 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
563 gbox->addWidget( pFgColor, line, 1 );
|
joachim99@8
|
564 ++line;
|
joachim99@8
|
565
|
joachim99@69
|
566 OptionColorButton* pBgColor = new OptionColorButton( Qt::white, "BgColor", &m_bgColor, page, this );
|
joachim99@8
|
567 label = new QLabel( pBgColor, i18n("Background color:"), page );
|
joachim99@8
|
568 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
569 gbox->addWidget( pBgColor, line, 1 );
|
joachim99@8
|
570
|
joachim99@8
|
571 ++line;
|
joachim99@8
|
572
|
joachim99@69
|
573 OptionColorButton* pDiffBgColor = new OptionColorButton(
|
joachim99@69
|
574 bLowColor ? Qt::lightGray : qRgb(224,224,224), "DiffBgColor", &m_diffBgColor, page, this );
|
joachim99@8
|
575 label = new QLabel( pDiffBgColor, i18n("Diff background color:"), page );
|
joachim99@8
|
576 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
577 gbox->addWidget( pDiffBgColor, line, 1 );
|
joachim99@8
|
578 ++line;
|
joachim99@8
|
579
|
joachim99@8
|
580 OptionColorButton* pColorA = new OptionColorButton(
|
joachim99@8
|
581 bLowColor ? qRgb(0,0,255) : qRgb(0,0,200)/*blue*/, "ColorA", &m_colorA, page, this );
|
joachim99@8
|
582 label = new QLabel( pColorA, i18n("Color A:"), page );
|
joachim99@8
|
583 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
584 gbox->addWidget( pColorA, line, 1 );
|
joachim99@8
|
585 ++line;
|
joachim99@8
|
586
|
joachim99@8
|
587 OptionColorButton* pColorB = new OptionColorButton(
|
joachim99@8
|
588 bLowColor ? qRgb(0,128,0) : qRgb(0,150,0)/*green*/, "ColorB", &m_colorB, page, this );
|
joachim99@8
|
589 label = new QLabel( pColorB, i18n("Color B:"), page );
|
joachim99@8
|
590 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
591 gbox->addWidget( pColorB, line, 1 );
|
joachim99@8
|
592 ++line;
|
joachim99@8
|
593
|
joachim99@8
|
594 OptionColorButton* pColorC = new OptionColorButton(
|
joachim99@8
|
595 bLowColor ? qRgb(128,0,128) : qRgb(150,0,150)/*magenta*/, "ColorC", &m_colorC, page, this );
|
joachim99@8
|
596 label = new QLabel( pColorC, i18n("Color C:"), page );
|
joachim99@8
|
597 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
598 gbox->addWidget( pColorC, line, 1 );
|
joachim99@8
|
599 ++line;
|
joachim99@8
|
600
|
joachim99@69
|
601 OptionColorButton* pColorForConflict = new OptionColorButton( Qt::red, "ColorForConflict", &m_colorForConflict, page, this );
|
joachim99@51
|
602 label = new QLabel( pColorForConflict, i18n("Conflict color:"), page );
|
joachim99@8
|
603 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
604 gbox->addWidget( pColorForConflict, line, 1 );
|
joachim99@8
|
605 ++line;
|
joachim99@8
|
606
|
joachim99@8
|
607 OptionColorButton* pColor = new OptionColorButton(
|
joachim99@8
|
608 bLowColor ? qRgb(192,192,192) : qRgb(220,220,100), "CurrentRangeBgColor", &m_currentRangeBgColor, page, this );
|
joachim99@8
|
609 label = new QLabel( pColor, i18n("Current range background color:"), page );
|
joachim99@8
|
610 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
611 gbox->addWidget( pColor, line, 1 );
|
joachim99@8
|
612 ++line;
|
joachim99@8
|
613
|
joachim99@8
|
614 pColor = new OptionColorButton(
|
joachim99@8
|
615 bLowColor ? qRgb(255,255,0) : qRgb(255,255,150), "CurrentRangeDiffBgColor", &m_currentRangeDiffBgColor, page, this );
|
joachim99@8
|
616 label = new QLabel( pColor, i18n("Current range diff background color:"), page );
|
joachim99@8
|
617 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
618 gbox->addWidget( pColor, line, 1 );
|
joachim99@8
|
619 ++line;
|
joachim99@8
|
620
|
joachim99@69
|
621 pColor = new OptionColorButton( qRgb(0xff,0xd0,0x80), "ManualAlignmentRangeColor", &m_manualHelpRangeColor, page, this );
|
joachim99@69
|
622 label = new QLabel( pColor, i18n("Color for manually aligned difference ranges:"), page );
|
joachim99@69
|
623 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
624 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
625 ++line;
|
joachim99@69
|
626
|
joachim99@69
|
627 label = new QLabel( i18n("Directory Comparison View:"), page );
|
joachim99@69
|
628 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
629 label->setFont(f);
|
joachim99@69
|
630 ++line;
|
joachim99@69
|
631
|
joachim99@69
|
632 pColor = new OptionColorButton( qRgb(0,0xd0,0), "NewestFileColor", &m_newestFileColor, page, this );
|
joachim99@69
|
633 label = new QLabel( pColor, i18n("Newest file color:"), page );
|
joachim99@69
|
634 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
635 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
636 QString dirColorTip = i18n( "Changing this color will only be effective when starting the next directory comparison.");
|
joachim99@69
|
637 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
638 ++line;
|
joachim99@69
|
639
|
joachim99@69
|
640 pColor = new OptionColorButton( qRgb(0xf0,0,0), "OldestFileColor", &m_oldestFileColor, page, this );
|
joachim99@69
|
641 label = new QLabel( pColor, i18n("Oldest file color:"), page );
|
joachim99@69
|
642 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
643 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
644 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
645 ++line;
|
joachim99@69
|
646
|
joachim99@69
|
647 pColor = new OptionColorButton( qRgb(0xc0,0xc0,0), "MidAgeFileColor", &m_midAgeFileColor, page, this );
|
joachim99@69
|
648 label = new QLabel( pColor, i18n("Middle age file color:"), page );
|
joachim99@69
|
649 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
650 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
651 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
652 ++line;
|
joachim99@69
|
653
|
joachim99@69
|
654 pColor = new OptionColorButton( qRgb(0,0,0), "MissingFileColor", &m_missingFileColor, page, this );
|
joachim99@69
|
655 label = new QLabel( pColor, i18n("Color for missing files:"), page );
|
joachim99@69
|
656 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
657 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
658 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
659 ++line;
|
joachim99@69
|
660
|
joachim99@8
|
661 topLayout->addStretch(10);
|
joachim99@8
|
662 }
|
joachim99@8
|
663
|
joachim99@8
|
664
|
joachim99@8
|
665 void OptionDialog::setupEditPage( void )
|
joachim99@8
|
666 {
|
joachim99@68
|
667 QFrame *page = addPage( i18n("Editor"), i18n("Editor Behavior"),
|
joachim99@8
|
668 BarIcon("edit", KIcon::SizeMedium ) );
|
joachim99@69
|
669 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
670
|
joachim99@8
|
671 QGridLayout *gbox = new QGridLayout( 4, 2 );
|
joachim99@69
|
672 gbox->setColStretch(1,5);
|
joachim99@8
|
673 topLayout->addLayout( gbox );
|
joachim99@8
|
674 QLabel* label;
|
joachim99@8
|
675 int line=0;
|
joachim99@8
|
676
|
joachim99@8
|
677 OptionCheckBox* pReplaceTabs = new OptionCheckBox( i18n("Tab inserts spaces"), false, "ReplaceTabs", &m_bReplaceTabs, page, this );
|
joachim99@8
|
678 gbox->addMultiCellWidget( pReplaceTabs, line, line, 0, 1 );
|
joachim99@8
|
679 QToolTip::add( pReplaceTabs, i18n(
|
joachim99@8
|
680 "On: Pressing tab generates the appropriate number of spaces.\n"
|
joachim99@8
|
681 "Off: A Tab-character will be inserted.")
|
joachim99@8
|
682 );
|
joachim99@8
|
683 ++line;
|
joachim99@8
|
684
|
joachim99@8
|
685 OptionIntEdit* pTabSize = new OptionIntEdit( 8, "TabSize", &m_tabSize, 1, 100, page, this );
|
joachim99@8
|
686 label = new QLabel( pTabSize, i18n("Tab size:"), page );
|
joachim99@8
|
687 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
688 gbox->addWidget( pTabSize, line, 1 );
|
joachim99@8
|
689 ++line;
|
joachim99@8
|
690
|
joachim99@51
|
691 OptionCheckBox* pAutoIndentation = new OptionCheckBox( i18n("Auto indentation"), true, "AutoIndentation", &m_bAutoIndentation, page, this );
|
joachim99@8
|
692 gbox->addMultiCellWidget( pAutoIndentation, line, line, 0, 1 );
|
joachim99@8
|
693 QToolTip::add( pAutoIndentation, i18n(
|
joachim99@8
|
694 "On: The indentation of the previous line is used for a new line.\n"
|
joachim99@8
|
695 ));
|
joachim99@8
|
696 ++line;
|
joachim99@8
|
697
|
joachim99@51
|
698 OptionCheckBox* pAutoCopySelection = new OptionCheckBox( i18n("Auto copy selection"), false, "AutoCopySelection", &m_bAutoCopySelection, page, this );
|
joachim99@8
|
699 gbox->addMultiCellWidget( pAutoCopySelection, line, line, 0, 1 );
|
joachim99@8
|
700 QToolTip::add( pAutoCopySelection, i18n(
|
joachim99@8
|
701 "On: Any selection is immediately written to the clipboard.\n"
|
joachim99@8
|
702 "Off: You must explicitely copy e.g. via Ctrl-C."
|
joachim99@8
|
703 ));
|
joachim99@8
|
704 ++line;
|
joachim99@58
|
705
|
joachim99@68
|
706 label = new QLabel( i18n("Line end style:"), page );
|
joachim99@58
|
707 gbox->addWidget( label, line, 0 );
|
joachim99@58
|
708 #ifdef _WIN32
|
joachim99@58
|
709 int defaultLineEndStyle = eLineEndDos;
|
joachim99@58
|
710 #else
|
joachim99@58
|
711 int defaultLineEndStyle = eLineEndUnix;
|
joachim99@58
|
712 #endif
|
joachim99@58
|
713 OptionComboBox* pLineEndStyle = new OptionComboBox( defaultLineEndStyle, "LineEndStyle", &m_lineEndStyle, page, this );
|
joachim99@58
|
714 gbox->addWidget( pLineEndStyle, line, 1 );
|
joachim99@58
|
715 pLineEndStyle->insertItem( "Unix", eLineEndUnix );
|
joachim99@58
|
716 pLineEndStyle->insertItem( "Dos/Windows", eLineEndDos );
|
joachim99@58
|
717 QToolTip::add( label, i18n(
|
joachim99@68
|
718 "Sets the line endings for when an edited file is saved.\n"
|
joachim99@68
|
719 "DOS/Windows: CR+LF; UNIX: LF; with CR=0D, LF=0A")
|
joachim99@58
|
720 );
|
joachim99@58
|
721 ++line;
|
joachim99@58
|
722
|
joachim99@8
|
723 topLayout->addStretch(10);
|
joachim99@8
|
724 }
|
joachim99@8
|
725
|
joachim99@8
|
726
|
joachim99@8
|
727 void OptionDialog::setupDiffPage( void )
|
joachim99@8
|
728 {
|
joachim99@69
|
729 QFrame *page = addPage( i18n("Diff and Merge"), i18n("Diff and Merge Settings"),
|
joachim99@8
|
730 BarIcon("misc", KIcon::SizeMedium ) );
|
joachim99@69
|
731 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
732
|
joachim99@8
|
733 QGridLayout *gbox = new QGridLayout( 3, 2 );
|
joachim99@69
|
734 gbox->setColStretch(1,5);
|
joachim99@8
|
735 topLayout->addLayout( gbox );
|
joachim99@8
|
736 int line=0;
|
joachim99@8
|
737
|
joachim99@51
|
738 QLabel* label=0;
|
joachim99@51
|
739
|
joachim99@51
|
740 OptionCheckBox* pPreserveCarriageReturn = new OptionCheckBox( i18n("Preserve carriage return"), false, "PreserveCarriageReturn", &m_bPreserveCarriageReturn, page, this );
|
joachim99@51
|
741 gbox->addMultiCellWidget( pPreserveCarriageReturn, line, line, 0, 1 );
|
joachim99@51
|
742 QToolTip::add( pPreserveCarriageReturn, i18n(
|
joachim99@51
|
743 "Show carriage return characters '\\r' if they exist.\n"
|
joachim99@51
|
744 "Helps to compare files that were modified under different operating systems.")
|
joachim99@8
|
745 );
|
joachim99@8
|
746 ++line;
|
joachim99@8
|
747
|
joachim99@51
|
748 OptionCheckBox* pIgnoreNumbers = new OptionCheckBox( i18n("Ignore numbers"), false, "IgnoreNumbers", &m_bIgnoreNumbers, page, this );
|
joachim99@51
|
749 gbox->addMultiCellWidget( pIgnoreNumbers, line, line, 0, 1 );
|
joachim99@51
|
750 QToolTip::add( pIgnoreNumbers, i18n(
|
joachim99@51
|
751 "Ignore number characters during line matching phase. (Similar to Ignore white space.)\n"
|
joachim99@51
|
752 "Might help to compare files with numeric data.")
|
joachim99@8
|
753 );
|
joachim99@8
|
754 ++line;
|
joachim99@8
|
755
|
joachim99@68
|
756 OptionCheckBox* pIgnoreComments = new OptionCheckBox( i18n("Ignore C/C++ comments"), false, "IgnoreComments", &m_bIgnoreComments, page, this );
|
joachim99@51
|
757 gbox->addMultiCellWidget( pIgnoreComments, line, line, 0, 1 );
|
joachim99@51
|
758 QToolTip::add( pIgnoreComments, i18n( "Treat C/C++ comments like white space.")
|
joachim99@8
|
759 );
|
joachim99@8
|
760 ++line;
|
joachim99@8
|
761
|
joachim99@66
|
762 OptionCheckBox* pIgnoreCase = new OptionCheckBox( i18n("Ignore case"), false, "IgnoreCase", &m_bIgnoreCase, page, this );
|
joachim99@66
|
763 gbox->addMultiCellWidget( pIgnoreCase, line, line, 0, 1 );
|
joachim99@66
|
764 QToolTip::add( pIgnoreCase, i18n(
|
joachim99@66
|
765 "Treat case differences like white space changes. ('a'<=>'A')")
|
joachim99@8
|
766 );
|
joachim99@8
|
767 ++line;
|
joachim99@8
|
768
|
joachim99@51
|
769 label = new QLabel( i18n("Preprocessor command:"), page );
|
joachim99@8
|
770 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
771 OptionLineEdit* pLE = new OptionLineEdit( "", "PreProcessorCmd", &m_PreProcessorCmd, page, this );
|
joachim99@8
|
772 gbox->addWidget( pLE, line, 1 );
|
joachim99@8
|
773 QToolTip::add( label, i18n("User defined pre-processing. (See the docs for details.)") );
|
joachim99@8
|
774 ++line;
|
joachim99@8
|
775
|
joachim99@51
|
776 label = new QLabel( i18n("Line-matching preprocessor command:"), page );
|
joachim99@8
|
777 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
778 pLE = new OptionLineEdit( "", "LineMatchingPreProcessorCmd", &m_LineMatchingPreProcessorCmd, page, this );
|
joachim99@8
|
779 gbox->addWidget( pLE, line, 1 );
|
joachim99@8
|
780 QToolTip::add( label, i18n("This pre-processor is only used during line matching.\n(See the docs for details.)") );
|
joachim99@8
|
781 ++line;
|
joachim99@8
|
782
|
joachim99@51
|
783 OptionCheckBox* pTryHard = new OptionCheckBox( i18n("Try hard (slower)"), true, "TryHard", &m_bTryHard, page, this );
|
joachim99@51
|
784 gbox->addMultiCellWidget( pTryHard, line, line, 0, 1 );
|
joachim99@51
|
785 QToolTip::add( pTryHard, i18n(
|
joachim99@51
|
786 "Enables the --minimal option for the external diff.\n"
|
joachim99@51
|
787 "The analysis of big files will be much slower.")
|
joachim99@8
|
788 );
|
joachim99@8
|
789 ++line;
|
joachim99@8
|
790
|
joachim99@51
|
791 label = new QLabel( i18n("Auto advance delay (ms):"), page );
|
joachim99@8
|
792 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
793 OptionIntEdit* pAutoAdvanceDelay = new OptionIntEdit( 500, "AutoAdvanceDelay", &m_autoAdvanceDelay, 0, 2000, page, this );
|
joachim99@8
|
794 gbox->addWidget( pAutoAdvanceDelay, line, 1 );
|
joachim99@8
|
795 QToolTip::add( label,i18n(
|
joachim99@8
|
796 "When in Auto-Advance mode the result of the current selection is shown \n"
|
joachim99@8
|
797 "for the specified time, before jumping to the next conflict. Range: 0-2000 ms")
|
joachim99@8
|
798 );
|
joachim99@8
|
799 ++line;
|
joachim99@8
|
800
|
joachim99@51
|
801 label = new QLabel( i18n("White space 2-file merge default:"), page );
|
joachim99@51
|
802 gbox->addWidget( label, line, 0 );
|
joachim99@51
|
803 OptionComboBox* pWhiteSpace2FileMergeDefault = new OptionComboBox( 0, "WhiteSpace2FileMergeDefault", &m_whiteSpace2FileMergeDefault, page, this );
|
joachim99@51
|
804 gbox->addWidget( pWhiteSpace2FileMergeDefault, line, 1 );
|
joachim99@68
|
805 pWhiteSpace2FileMergeDefault->insertItem( i18n("Manual Choice"), 0 );
|
joachim99@51
|
806 pWhiteSpace2FileMergeDefault->insertItem( "A", 1 );
|
joachim99@51
|
807 pWhiteSpace2FileMergeDefault->insertItem( "B", 2 );
|
joachim99@58
|
808 QToolTip::add( label, i18n(
|
joachim99@51
|
809 "Allow the merge algorithm to automatically select an input for "
|
joachim99@51
|
810 "white-space-only changes." )
|
joachim99@51
|
811 );
|
joachim99@51
|
812 ++line;
|
joachim99@51
|
813
|
joachim99@51
|
814 label = new QLabel( i18n("White space 3-file merge default:"), page );
|
joachim99@51
|
815 gbox->addWidget( label, line, 0 );
|
joachim99@51
|
816 OptionComboBox* pWhiteSpace3FileMergeDefault = new OptionComboBox( 0, "WhiteSpace3FileMergeDefault", &m_whiteSpace3FileMergeDefault, page, this );
|
joachim99@51
|
817 gbox->addWidget( pWhiteSpace3FileMergeDefault, line, 1 );
|
joachim99@68
|
818 pWhiteSpace3FileMergeDefault->insertItem( i18n("Manual Choice"), 0 );
|
joachim99@51
|
819 pWhiteSpace3FileMergeDefault->insertItem( "A", 1 );
|
joachim99@51
|
820 pWhiteSpace3FileMergeDefault->insertItem( "B", 2 );
|
joachim99@51
|
821 pWhiteSpace3FileMergeDefault->insertItem( "C", 3 );
|
joachim99@58
|
822 QToolTip::add( label, i18n(
|
joachim99@51
|
823 "Allow the merge algorithm to automatically select an input for "
|
joachim99@51
|
824 "white-space-only changes." )
|
joachim99@51
|
825 );
|
joachim99@51
|
826 ++line;
|
joachim99@51
|
827
|
joachim99@69
|
828 QGroupBox* pGroupBox = new QGroupBox( 2, Qt::Horizontal, i18n("Automatic Merge Regular Expression"), page);
|
joachim99@69
|
829 gbox->addMultiCellWidget( pGroupBox, line,line,0,1);
|
joachim99@69
|
830 ++line;
|
joachim99@69
|
831 {
|
joachim99@69
|
832 QWidget* page = new QWidget( pGroupBox );
|
joachim99@69
|
833 QGridLayout* gbox = new QGridLayout( page, 2, 2, spacingHint() );
|
joachim99@69
|
834 gbox->setColStretch(1,10);
|
joachim99@69
|
835 int line = 0;
|
joachim99@69
|
836
|
joachim99@69
|
837 label = new QLabel( i18n("Auto merge regular expression:"), page );
|
joachim99@69
|
838 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
839 m_pAutoMergeRegExpLineEdit = new OptionLineEdit( ".*\\$(Version|Header|Date|Author).*\\$.*", "AutoMergeRegExp", &m_autoMergeRegExp, page, this );
|
joachim99@69
|
840 gbox->addWidget( m_pAutoMergeRegExpLineEdit, line, 1 );
|
joachim99@69
|
841 s_autoMergeRegExpToolTip = i18n("Regular expression for lines where KDiff3 should automatically choose one source.\n"
|
joachim99@69
|
842 "When a line with a conflict matches the regular expression then\n"
|
joachim99@69
|
843 "- if available - C, otherwise B will be chosen.");
|
joachim99@69
|
844 QToolTip::add( label, s_autoMergeRegExpToolTip );
|
joachim99@69
|
845 ++line;
|
joachim99@69
|
846
|
joachim99@69
|
847 OptionCheckBox* pAutoMergeRegExp = new OptionCheckBox( i18n("Run regular expression auto merge on merge start"), false, "RunRegExpAutoMergeOnMergeStart", &m_bRunRegExpAutoMergeOnMergeStart, page, this );
|
joachim99@69
|
848 gbox->addMultiCellWidget( pAutoMergeRegExp, line, line, 0, 1 );
|
joachim99@69
|
849 QToolTip::add( pAutoMergeRegExp, i18n( "Run the merge for auto merge regular expressions\n"
|
joachim99@69
|
850 "immediately when a merge starts.\n"));
|
joachim99@69
|
851 ++line;
|
joachim99@69
|
852 }
|
joachim99@69
|
853
|
joachim99@69
|
854 pGroupBox = new QGroupBox( 2, Qt::Horizontal, i18n("Version Control History Merging"), page);
|
joachim99@69
|
855 gbox->addMultiCellWidget( pGroupBox, line,line,0,1);
|
joachim99@69
|
856 ++line;
|
joachim99@69
|
857 {
|
joachim99@69
|
858 QWidget* page = new QWidget( pGroupBox );
|
joachim99@69
|
859 QGridLayout* gbox = new QGridLayout( page, 2, 2, spacingHint() );
|
joachim99@69
|
860 gbox->setColStretch(1,10);
|
joachim99@69
|
861 int line = 0;
|
joachim99@69
|
862
|
joachim99@69
|
863 label = new QLabel( i18n("History start regular expression:"), page );
|
joachim99@69
|
864 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
865 m_pHistoryStartRegExpLineEdit = new OptionLineEdit( ".*\\$Log.*\\$.*", "HistoryStartRegExp", &m_historyStartRegExp, page, this );
|
joachim99@69
|
866 gbox->addWidget( m_pHistoryStartRegExpLineEdit, line, 1 );
|
joachim99@69
|
867 s_historyStartRegExpToolTip = i18n("Regular expression for the start of the version control history entry.\n"
|
joachim99@69
|
868 "Usually this line contains the \"$Log$
|
joachim99@69
|
869 "Usually this line contains the \"Revision 1.7 2006/04/10 08:37:33 joachim99
|
joachim99@69
|
870 "Usually this line contains the \"KDiff3 0.9.89
|
joachim99@69
|
871 "Usually this line contains the \"\"-keyword.\n"
|
joachim99@69
|
872 "Default value: \".*\\$Log.*\\$.*\"");
|
joachim99@69
|
873 QToolTip::add( label, s_historyStartRegExpToolTip );
|
joachim99@69
|
874 ++line;
|
joachim99@69
|
875
|
joachim99@69
|
876 label = new QLabel( i18n("History entry start regular expression:"), page );
|
joachim99@69
|
877 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
878 // Example line: "** \main\rolle_fsp_dev_008\1 17 Aug 2001 10:45:44 rolle"
|
joachim99@69
|
879 QString historyEntryStartDefault =
|
joachim99@69
|
880 "\\s*\\\\main\\\\(\\S+)\\s+" // Start with "\main\"
|
joachim99@69
|
881 "([0-9]+) " // day
|
joachim99@69
|
882 "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) " //month
|
joachim99@69
|
883 "([0-9][0-9][0-9][0-9]) " // year
|
joachim99@69
|
884 "([0-9][0-9]:[0-9][0-9]:[0-9][0-9])\\s+(.*)"; // time, name
|
joachim99@69
|
885
|
joachim99@69
|
886 m_pHistoryEntryStartRegExpLineEdit = new OptionLineEdit( historyEntryStartDefault, "HistoryEntryStartRegExp", &m_historyEntryStartRegExp, page, this );
|
joachim99@69
|
887 gbox->addWidget( m_pHistoryEntryStartRegExpLineEdit, line, 1 );
|
joachim99@69
|
888 s_historyEntryStartRegExpToolTip = i18n("A version control history entry consists of several lines.\n"
|
joachim99@69
|
889 "Specify the regular expression to detect the first line (without the leading comment).\n"
|
joachim99@69
|
890 "Use parentheses to group the keys you want to use for sorting.\n"
|
joachim99@69
|
891 "If left empty, then KDiff3 assumes that empty lines separate history entries.\n"
|
joachim99@69
|
892 "See the documentation for details.");
|
joachim99@69
|
893 QToolTip::add( label, s_historyEntryStartRegExpToolTip );
|
joachim99@69
|
894 ++line;
|
joachim99@69
|
895
|
joachim99@69
|
896 m_pHistoryMergeSorting = new OptionCheckBox( i18n("History merge sorting"), false, "HistoryMergeSorting", &m_bHistoryMergeSorting, page, this );
|
joachim99@69
|
897 gbox->addMultiCellWidget( m_pHistoryMergeSorting, line, line, 0, 1 );
|
joachim99@69
|
898 QToolTip::add( m_pHistoryMergeSorting, i18n("Sort version control history by a key.") );
|
joachim99@69
|
899 ++line;
|
joachim99@69
|
900 //QString branch = newHistoryEntry.cap(1);
|
joachim99@69
|
901 //int day = newHistoryEntry.cap(2).toInt();
|
joachim99@69
|
902 //int month = QString("Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec").find(newHistoryEntry.cap(3))/4 + 1;
|
joachim99@69
|
903 //int year = newHistoryEntry.cap(4).toInt();
|
joachim99@69
|
904 //QString time = newHistoryEntry.cap(5);
|
joachim99@69
|
905 //QString name = newHistoryEntry.cap(6);
|
joachim99@69
|
906 QString defaultSortKeyOrder = "4,3,2,5,1,6"; //QDate(year,month,day).toString(Qt::ISODate) +" "+ time + " " + branch + " " + name;
|
joachim99@69
|
907
|
joachim99@69
|
908 label = new QLabel( i18n("History entry start sort key order:"), page );
|
joachim99@69
|
909 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
910 m_pHistorySortKeyOrderLineEdit = new OptionLineEdit( defaultSortKeyOrder, "HistoryEntryStartSortKeyOrder", &m_historyEntryStartSortKeyOrder, page, this );
|
joachim99@69
|
911 gbox->addWidget( m_pHistorySortKeyOrderLineEdit, line, 1 );
|
joachim99@69
|
912 s_historyEntryStartSortKeyOrderToolTip = i18n("Each parentheses used in the regular expression for the history start entry\n"
|
joachim99@69
|
913 "groups a key that can be used for sorting.\n"
|
joachim99@69
|
914 "Specify the list of keys (that are numbered in order of occurrence\n"
|
joachim99@69
|
915 "starting with 1) using ',' as separator (e.g. \"4,5,6,1,2,3,7\").\n"
|
joachim99@69
|
916 "If left empty, then no sorting will be done.\n"
|
joachim99@69
|
917 "See the documentation for details.");
|
joachim99@69
|
918 QToolTip::add( label, s_historyEntryStartSortKeyOrderToolTip );
|
joachim99@69
|
919 m_pHistorySortKeyOrderLineEdit->setEnabled(false);
|
joachim99@69
|
920 connect( m_pHistoryMergeSorting, SIGNAL(toggled(bool)), m_pHistorySortKeyOrderLineEdit, SLOT(setEnabled(bool)));
|
joachim99@69
|
921 ++line;
|
joachim99@69
|
922
|
joachim99@69
|
923 m_pHistoryAutoMerge = new OptionCheckBox( i18n("Merge version control history on merge start"), false, "RunHistoryAutoMergeOnMergeStart", &m_bRunHistoryAutoMergeOnMergeStart, page, this );
|
joachim99@69
|
924 gbox->addMultiCellWidget( m_pHistoryAutoMerge, line, line, 0, 1 );
|
joachim99@69
|
925 QToolTip::add( m_pHistoryAutoMerge, i18n("Run version control history automerge on merge start.") );
|
joachim99@69
|
926 ++line;
|
joachim99@69
|
927 }
|
joachim99@69
|
928
|
joachim99@69
|
929 QPushButton* pButton = new QPushButton( i18n("Test your regular expressions"), page );
|
joachim99@69
|
930 gbox->addWidget( pButton, line, 0 );
|
joachim99@69
|
931 connect( pButton, SIGNAL(clicked()), this, SLOT(slotHistoryMergeRegExpTester()));
|
joachim99@69
|
932 ++line;
|
joachim99@69
|
933
|
joachim99@69
|
934 label = new QLabel( i18n("Irrelevant merge command:"), page );
|
joachim99@69
|
935 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
936 pLE = new OptionLineEdit( "", "IrrelevantMergeCmd", &m_IrrelevantMergeCmd, page, this );
|
joachim99@69
|
937 gbox->addWidget( pLE, line, 1 );
|
joachim99@69
|
938 QToolTip::add( label, i18n("If specified this script is run after automerge\n"
|
joachim99@69
|
939 "when no other relevant changes were detected.\n"
|
joachim99@69
|
940 "Called with the parameters: filename1 filename2 filename3") );
|
joachim99@69
|
941 ++line;
|
joachim99@69
|
942
|
joachim99@8
|
943 topLayout->addStretch(10);
|
joachim99@8
|
944 }
|
joachim99@8
|
945
|
joachim99@8
|
946 void OptionDialog::setupDirectoryMergePage( void )
|
joachim99@8
|
947 {
|
joachim99@51
|
948 QFrame *page = addPage( i18n("Directory Merge"), i18n("Directory Merge"),
|
joachim99@8
|
949 BarIcon("folder", KIcon::SizeMedium ) );
|
joachim99@69
|
950 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
951
|
joachim99@8
|
952 QGridLayout *gbox = new QGridLayout( 11, 2 );
|
joachim99@69
|
953 gbox->setColStretch(1,5);
|
joachim99@8
|
954 topLayout->addLayout( gbox );
|
joachim99@8
|
955 int line=0;
|
joachim99@8
|
956
|
joachim99@51
|
957 OptionCheckBox* pRecursiveDirs = new OptionCheckBox( i18n("Recursive directories"), true, "RecursiveDirs", &m_bDmRecursiveDirs, page, this );
|
joachim99@8
|
958 gbox->addMultiCellWidget( pRecursiveDirs, line, line, 0, 1 );
|
joachim99@8
|
959 QToolTip::add( pRecursiveDirs, i18n("Whether to analyze subdirectories or not.") );
|
joachim99@8
|
960 ++line;
|
joachim99@51
|
961 QLabel* label = new QLabel( i18n("File pattern(s):"), page );
|
joachim99@8
|
962 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
963 OptionLineEdit* pFilePattern = new OptionLineEdit( "*", "FilePattern", &m_DmFilePattern, page, this );
|
joachim99@8
|
964 gbox->addWidget( pFilePattern, line, 1 );
|
joachim99@8
|
965 QToolTip::add( label, i18n(
|
joachim99@8
|
966 "Pattern(s) of files to be analyzed. \n"
|
joachim99@8
|
967 "Wildcards: '*' and '?'\n"
|
joachim99@8
|
968 "Several Patterns can be specified by using the separator: ';'"
|
joachim99@8
|
969 ));
|
joachim99@8
|
970 ++line;
|
joachim99@8
|
971
|
joachim99@51
|
972 label = new QLabel( i18n("File-anti-pattern(s):"), page );
|
joachim99@8
|
973 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
974 OptionLineEdit* pFileAntiPattern = new OptionLineEdit( "*.orig;*.o;*.obj", "FileAntiPattern", &m_DmFileAntiPattern, page, this );
|
joachim99@8
|
975 gbox->addWidget( pFileAntiPattern, line, 1 );
|
joachim99@8
|
976 QToolTip::add( label, i18n(
|
joachim99@8
|
977 "Pattern(s) of files to be excluded from analysis. \n"
|
joachim99@8
|
978 "Wildcards: '*' and '?'\n"
|
joachim99@8
|
979 "Several Patterns can be specified by using the separator: ';'"
|
joachim99@8
|
980 ));
|
joachim99@8
|
981 ++line;
|
joachim99@8
|
982
|
joachim99@51
|
983 label = new QLabel( i18n("Dir-anti-pattern(s):"), page );
|
joachim99@8
|
984 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
985 OptionLineEdit* pDirAntiPattern = new OptionLineEdit( "CVS;.deps;.svn", "DirAntiPattern", &m_DmDirAntiPattern, page, this );
|
joachim99@8
|
986 gbox->addWidget( pDirAntiPattern, line, 1 );
|
joachim99@8
|
987 QToolTip::add( label, i18n(
|
joachim99@8
|
988 "Pattern(s) of directories to be excluded from analysis. \n"
|
joachim99@8
|
989 "Wildcards: '*' and '?'\n"
|
joachim99@8
|
990 "Several Patterns can be specified by using the separator: ';'"
|
joachim99@8
|
991 ));
|
joachim99@8
|
992 ++line;
|
joachim99@8
|
993
|
joachim99@51
|
994 OptionCheckBox* pUseCvsIgnore = new OptionCheckBox( i18n("Use .cvsignore"), false, "UseCvsIgnore", &m_bDmUseCvsIgnore, page, this );
|
joachim99@8
|
995 gbox->addMultiCellWidget( pUseCvsIgnore, line, line, 0, 1 );
|
joachim99@8
|
996 QToolTip::add( pUseCvsIgnore, i18n(
|
joachim99@8
|
997 "Extends the antipattern to anything that would be ignored by CVS.\n"
|
joachim99@8
|
998 "Via local \".cvsignore\"-files this can be directory specific."
|
joachim99@8
|
999 ));
|
joachim99@8
|
1000 ++line;
|
joachim99@8
|
1001
|
joachim99@51
|
1002 OptionCheckBox* pFindHidden = new OptionCheckBox( i18n("Find hidden files and directories"), true, "FindHidden", &m_bDmFindHidden, page, this );
|
joachim99@8
|
1003 gbox->addMultiCellWidget( pFindHidden, line, line, 0, 1 );
|
joachim99@8
|
1004 #ifdef _WIN32
|
joachim99@8
|
1005 QToolTip::add( pFindHidden, i18n("Finds files and directories with the hidden attribute.") );
|
joachim99@8
|
1006 #else
|
joachim99@8
|
1007 QToolTip::add( pFindHidden, i18n("Finds files and directories starting with '.'.") );
|
joachim99@8
|
1008 #endif
|
joachim99@8
|
1009 ++line;
|
joachim99@8
|
1010
|
joachim99@51
|
1011 OptionCheckBox* pFollowFileLinks = new OptionCheckBox( i18n("Follow file links"), false, "FollowFileLinks", &m_bDmFollowFileLinks, page, this );
|
joachim99@8
|
1012 gbox->addMultiCellWidget( pFollowFileLinks, line, line, 0, 1 );
|
joachim99@8
|
1013 QToolTip::add( pFollowFileLinks, i18n(
|
joachim99@8
|
1014 "On: Compare the file the link points to.\n"
|
joachim99@8
|
1015 "Off: Compare the links."
|
joachim99@8
|
1016 ));
|
joachim99@8
|
1017 ++line;
|
joachim99@8
|
1018
|
joachim99@51
|
1019 OptionCheckBox* pFollowDirLinks = new OptionCheckBox( i18n("Follow directory links"), false, "FollowDirLinks", &m_bDmFollowDirLinks, page, this );
|
joachim99@8
|
1020 gbox->addMultiCellWidget( pFollowDirLinks, line, line, 0, 1 );
|
joachim99@8
|
1021 QToolTip::add( pFollowDirLinks, i18n(
|
joachim99@8
|
1022 "On: Compare the directory the link points to.\n"
|
joachim99@8
|
1023 "Off: Compare the links."
|
joachim99@8
|
1024 ));
|
joachim99@8
|
1025 ++line;
|
joachim99@8
|
1026
|
joachim99@69
|
1027 //OptionCheckBox* pShowOnlyDeltas = new OptionCheckBox( i18n("List only deltas"),false,"ListOnlyDeltas", &m_bDmShowOnlyDeltas, page, this );
|
joachim99@69
|
1028 //gbox->addMultiCellWidget( pShowOnlyDeltas, line, line, 0, 1 );
|
joachim99@69
|
1029 //QToolTip::add( pShowOnlyDeltas, i18n(
|
joachim99@69
|
1030 // "Files and directories without change will not appear in the list."));
|
joachim99@69
|
1031 //++line;
|
joachim99@69
|
1032
|
joachim99@69
|
1033 #ifdef _WIN32
|
joachim99@69
|
1034 bool bCaseSensitiveFilenameComparison = false;
|
joachim99@69
|
1035 #else
|
joachim99@69
|
1036 bool bCaseSensitiveFilenameComparison = true;
|
joachim99@69
|
1037 #endif
|
joachim99@69
|
1038 OptionCheckBox* pCaseSensitiveFileNames = new OptionCheckBox( i18n("Case sensitive filename comparison"),bCaseSensitiveFilenameComparison,"CaseSensitiveFilenameComparison", &m_bDmCaseSensitiveFilenameComparison, page, this );
|
joachim99@69
|
1039 gbox->addMultiCellWidget( pCaseSensitiveFileNames, line, line, 0, 1 );
|
joachim99@69
|
1040 QToolTip::add( pCaseSensitiveFileNames, i18n(
|
joachim99@69
|
1041 "The directory comparison will compare files or directories when their names match.\n"
|
joachim99@69
|
1042 "Set this option if the case of the names must match. (Default for Windows is off, otherwise on.)"));
|
joachim99@8
|
1043 ++line;
|
joachim99@8
|
1044
|
joachim99@66
|
1045 QVButtonGroup* pBG = new QVButtonGroup(i18n("File Comparison Mode"),page);
|
joachim99@66
|
1046 gbox->addMultiCellWidget( pBG, line, line, 0, 1 );
|
joachim99@66
|
1047 ++line;
|
joachim99@66
|
1048
|
joachim99@68
|
1049 OptionRadioButton* pBinaryComparison = new OptionRadioButton( i18n("Binary comparison"), true, "BinaryComparison", &m_bDmBinaryComparison, pBG, this );
|
joachim99@66
|
1050 QToolTip::add( pBinaryComparison, i18n("Binary comparison of each file. (Default)") );
|
joachim99@66
|
1051
|
joachim99@68
|
1052 OptionRadioButton* pFullAnalysis = new OptionRadioButton( i18n("Full analysis"), false, "FullAnalysis", &m_bDmFullAnalysis, pBG, this );
|
joachim99@66
|
1053 QToolTip::add( pFullAnalysis, i18n("Do a full analysis and show statistics information in extra columns.\n"
|
joachim99@66
|
1054 "(Slower than a binary comparison, much slower for binary files.)") );
|
joachim99@66
|
1055
|
joachim99@66
|
1056 OptionRadioButton* pTrustDate = new OptionRadioButton( i18n("Trust the modification date (unsafe)"), false, "TrustDate", &m_bDmTrustDate, pBG, this );
|
joachim99@8
|
1057 QToolTip::add( pTrustDate, i18n("Assume that files are equal if the modification date and file length are equal.\n"
|
joachim99@8
|
1058 "Useful for big directories or slow networks.") );
|
joachim99@8
|
1059
|
joachim99@66
|
1060 OptionRadioButton* pTrustSize = new OptionRadioButton( i18n("Trust the size (unsafe)"), false, "TrustSize", &m_bDmTrustSize, pBG, this );
|
joachim99@51
|
1061 QToolTip::add( pTrustSize, i18n("Assume that files are equal if their file lengths are equal.\n"
|
joachim99@51
|
1062 "Useful for big directories or slow networks when the date is modified during download.") );
|
joachim99@51
|
1063
|
joachim99@8
|
1064 // Some two Dir-options: Affects only the default actions.
|
joachim99@51
|
1065 OptionCheckBox* pSyncMode = new OptionCheckBox( i18n("Synchronize directories"), false,"SyncMode", &m_bDmSyncMode, page, this );
|
joachim99@8
|
1066 gbox->addMultiCellWidget( pSyncMode, line, line, 0, 1 );
|
joachim99@8
|
1067 QToolTip::add( pSyncMode, i18n(
|
joachim99@8
|
1068 "Offers to store files in both directories so that\n"
|
joachim99@8
|
1069 "both directories are the same afterwards.\n"
|
joachim99@8
|
1070 "Works only when comparing two directories without specifying a destination." ) );
|
joachim99@8
|
1071 ++line;
|
joachim99@8
|
1072
|
joachim99@68
|
1073 // Allow white-space only differences to be considered equal
|
joachim99@68
|
1074 OptionCheckBox* pWhiteSpaceDiffsEqual = new OptionCheckBox( i18n("White space differences considered equal"), false,"WhiteSpaceEqual", &m_bDmWhiteSpaceEqual, page, this );
|
joachim99@68
|
1075 gbox->addMultiCellWidget( pWhiteSpaceDiffsEqual, line, line, 0, 1 );
|
joachim99@68
|
1076 QToolTip::add( pWhiteSpaceDiffsEqual, i18n(
|
joachim99@68
|
1077 "If files differ only by white space consider them equal.\n"
|
joachim99@68
|
1078 "This is only active when full analysis is chosen." ) );
|
joachim99@68
|
1079 connect(pFullAnalysis, SIGNAL(toggled(bool)), pWhiteSpaceDiffsEqual, SLOT(setEnabled(bool)));
|
joachim99@68
|
1080 pWhiteSpaceDiffsEqual->setEnabled(false);
|
joachim99@68
|
1081 ++line;
|
joachim99@68
|
1082
|
joachim99@51
|
1083 OptionCheckBox* pCopyNewer = new OptionCheckBox( i18n("Copy newer instead of merging (unsafe)"), false, "CopyNewer", &m_bDmCopyNewer, page, this );
|
joachim99@8
|
1084 gbox->addMultiCellWidget( pCopyNewer, line, line, 0, 1 );
|
joachim99@8
|
1085 QToolTip::add( pCopyNewer, i18n(
|
joachim99@8
|
1086 "Don't look inside, just take the newer file.\n"
|
joachim99@8
|
1087 "(Use this only if you know what you are doing!)\n"
|
joachim99@8
|
1088 "Only effective when comparing two directories." ) );
|
joachim99@8
|
1089 ++line;
|
joachim99@51
|
1090
|
joachim99@8
|
1091 OptionCheckBox* pCreateBakFiles = new OptionCheckBox( i18n("Backup files (.orig)"), true, "CreateBakFiles", &m_bDmCreateBakFiles, page, this );
|
joachim99@8
|
1092 gbox->addMultiCellWidget( pCreateBakFiles, line, line, 0, 1 );
|
joachim99@8
|
1093 QToolTip::add( pCreateBakFiles, i18n(
|
joachim99@8
|
1094 "When a file would be saved over an old file, then the old file\n"
|
joachim99@8
|
1095 "will be renamed with a '.orig'-extension instead of being deleted."));
|
joachim99@8
|
1096 ++line;
|
joachim99@8
|
1097
|
joachim99@8
|
1098 topLayout->addStretch(10);
|
joachim99@8
|
1099 }
|
joachim99@66
|
1100 /*
|
joachim99@58
|
1101 static void insertCodecs(OptionComboBox* p)
|
joachim99@58
|
1102 {
|
joachim99@58
|
1103 std::multimap<QString,QString> m; // Using the multimap for case-insensitive sorting.
|
joachim99@58
|
1104 int i;
|
joachim99@58
|
1105 for(i=0;;++i)
|
joachim99@58
|
1106 {
|
joachim99@58
|
1107 QTextCodec* pCodec = QTextCodec::codecForIndex ( i );
|
joachim99@58
|
1108 if ( pCodec != 0 ) m.insert( std::make_pair( QString(pCodec->mimeName()).upper(), pCodec->mimeName()) );
|
joachim99@58
|
1109 else break;
|
joachim99@58
|
1110 }
|
joachim99@58
|
1111
|
joachim99@58
|
1112 p->insertItem( i18n("Auto"), 0 );
|
joachim99@58
|
1113 std::multimap<QString,QString>::iterator mi;
|
joachim99@58
|
1114 for(mi=m.begin(), i=0; mi!=m.end(); ++mi, ++i)
|
joachim99@58
|
1115 p->insertItem(mi->second, i+1);
|
joachim99@58
|
1116 }
|
joachim99@66
|
1117 */
|
joachim99@58
|
1118
|
joachim99@58
|
1119 void OptionDialog::setupRegionalPage( void )
|
joachim99@58
|
1120 {
|
joachim99@68
|
1121 QFrame *page = addPage( i18n("Regional Settings"), i18n("Regional Settings"),
|
joachim99@68
|
1122 BarIcon("locale"/*"charset"*/, KIcon::SizeMedium ) );
|
joachim99@69
|
1123 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@68
|
1124
|
joachim99@68
|
1125 QGridLayout *gbox = new QGridLayout( 3, 2 );
|
joachim99@69
|
1126 gbox->setColStretch(1,5);
|
joachim99@68
|
1127 topLayout->addLayout( gbox );
|
joachim99@68
|
1128 int line=0;
|
joachim99@68
|
1129
|
joachim99@68
|
1130 QLabel* label;
|
joachim99@68
|
1131
|
joachim99@69
|
1132 #ifdef KREPLACEMENTS_H
|
joachim99@66
|
1133
|
joachim99@66
|
1134 static char* countryMap[]={
|
joachim99@66
|
1135 "af Afrikaans",
|
joachim99@66
|
1136 "ar Arabic",
|
joachim99@66
|
1137 "az Azerbaijani",
|
joachim99@66
|
1138 "be Belarusian",
|
joachim99@66
|
1139 "bg Bulgarian",
|
joachim99@66
|
1140 "bn Bengali",
|
joachim99@66
|
1141 "bo Tibetan",
|
joachim99@66
|
1142 "br Breton",
|
joachim99@66
|
1143 "bs Bosnian",
|
joachim99@66
|
1144 "ca Catalan",
|
joachim99@66
|
1145 "cs Czech",
|
joachim99@66
|
1146 "cy Welsh",
|
joachim99@66
|
1147 "da Danish",
|
joachim99@66
|
1148 "de German",
|
joachim99@66
|
1149 "el Greek",
|
joachim99@66
|
1150 "en_GB British English",
|
joachim99@66
|
1151 "eo Esperanto",
|
joachim99@66
|
1152 "es Spanish",
|
joachim99@66
|
1153 "et Estonian",
|
joachim99@66
|
1154 "eu Basque",
|
joachim99@66
|
1155 "fa Farsi (Persian)",
|
joachim99@66
|
1156 "fi Finnish",
|
joachim99@66
|
1157 "fo Faroese",
|
joachim99@66
|
1158 "fr French",
|
joachim99@66
|
1159 "ga Irish Gaelic",
|
joachim99@66
|
1160 "gl Galician",
|
joachim99@66
|
1161 "gu Gujarati",
|
joachim99@66
|
1162 "he Hebrew",
|
joachim99@66
|
1163 "hi Hindi",
|
joachim99@66
|
1164 "hr Croatian",
|
joachim99@66
|
1165 "hsb Upper Sorbian",
|
joachim99@66
|
1166 "hu Hungarian",
|
joachim99@66
|
1167 "id Indonesian",
|
joachim99@66
|
1168 "is Icelandic",
|
joachim99@66
|
1169 "it Italian",
|
joachim99@66
|
1170 "ja Japanese",
|
joachim99@69
|
1171 "ka Georgian",
|
joachim99@66
|
1172 "ko Korean",
|
joachim99@66
|
1173 "ku Kurdish",
|
joachim99@66
|
1174 "lo Lao",
|
joachim99@66
|
1175 "lt Lithuanian",
|
joachim99@66
|
1176 "lv Latvian",
|
joachim99@66
|
1177 "mi Maori",
|
joachim99@66
|
1178 "mk Macedonian",
|
joachim99@66
|
1179 "mn Mongolian",
|
joachim99@66
|
1180 "ms Malay",
|
joachim99@66
|
1181 "mt Maltese",
|
joachim99@66
|
1182 "nb Norwegian Bookmal",
|
joachim99@66
|
1183 "nds Low Saxon",
|
joachim99@66
|
1184 "nl Dutch",
|
joachim99@66
|
1185 "nn Norwegian Nynorsk",
|
joachim99@66
|
1186 "nso Northern Sotho",
|
joachim99@66
|
1187 "oc Occitan",
|
joachim99@66
|
1188 "pl Polish",
|
joachim99@66
|
1189 "pt Portuguese",
|
joachim99@66
|
1190 "pt_BR Brazilian Portuguese",
|
joachim99@66
|
1191 "ro Romanian",
|
joachim99@66
|
1192 "ru Russian",
|
joachim99@69
|
1193 "rw Kinyarwanda",
|
joachim99@66
|
1194 "se Northern Sami",
|
joachim99@66
|
1195 "sk Slovak",
|
joachim99@66
|
1196 "sl Slovenian",
|
joachim99@66
|
1197 "sq Albanian",
|
joachim99@66
|
1198 "sr Serbian",
|
joachim99@69
|
1199 "sr@Latn Serbian",
|
joachim99@66
|
1200 "ss Swati",
|
joachim99@66
|
1201 "sv Swedish",
|
joachim99@66
|
1202 "ta Tamil",
|
joachim99@66
|
1203 "tg Tajik",
|
joachim99@66
|
1204 "th Thai",
|
joachim99@66
|
1205 "tr Turkish",
|
joachim99@66
|
1206 "uk Ukrainian",
|
joachim99@66
|
1207 "uz Uzbek",
|
joachim99@66
|
1208 "ven Venda",
|
joachim99@66
|
1209 "vi Vietnamese",
|
joachim99@66
|
1210 "wa Walloon",
|
joachim99@66
|
1211 "xh Xhosa",
|
joachim99@66
|
1212 "zh_CN Chinese Simplified",
|
joachim99@66
|
1213 "zh_TW Chinese Traditional",
|
joachim99@66
|
1214 "zu Zulu"
|
joachim99@66
|
1215 };
|
joachim99@66
|
1216
|
joachim99@58
|
1217 label = new QLabel( i18n("Language (restart required)"), page );
|
joachim99@58
|
1218 gbox->addWidget( label, line, 0 );
|
joachim99@58
|
1219 OptionComboBox* pLanguage = new OptionComboBox( 0, "Language", &m_language, page, this );
|
joachim99@58
|
1220 gbox->addWidget( pLanguage, line, 1 );
|
joachim99@66
|
1221 pLanguage->insertItem( "Auto", 0 ); // Must not translate, won't work otherwise!
|
joachim99@66
|
1222 pLanguage->insertItem( "en_orig" );
|
joachim99@66
|
1223
|
joachim99@66
|
1224 // Read directory: Find all kdiff3_*.qm-files and insert the found files here selection
|
joachim99@66
|
1225 FileAccess fa( getTranslationDir() );
|
joachim99@66
|
1226 t_DirectoryList dirList;
|
joachim99@66
|
1227 fa.listDir( &dirList, false, false, "kdiff3_*.qm", "", "*", false, false );
|
joachim99@66
|
1228 t_DirectoryList::iterator i;
|
joachim99@66
|
1229 for( i=dirList.begin(); i!=dirList.end(); ++i)
|
joachim99@66
|
1230 {
|
joachim99@66
|
1231 QString fileName = i->fileName();
|
joachim99@66
|
1232 // Skip the "kdiff3_" and omit the .qm
|
joachim99@66
|
1233 QString languageId = fileName.mid(7, fileName.length()-10 );
|
joachim99@66
|
1234
|
joachim99@66
|
1235 unsigned int countryIdx=0;
|
joachim99@66
|
1236 for(countryIdx=0; countryIdx< sizeof(countryMap)/sizeof(countryMap[0]); ++countryIdx )
|
joachim99@66
|
1237 {
|
joachim99@66
|
1238 QString fullName = countryMap[countryIdx];
|
joachim99@66
|
1239 if ( languageId+" " == fullName.left(languageId.length()+1) )
|
joachim99@66
|
1240 {
|
joachim99@66
|
1241 languageId += " (" + fullName.mid(languageId.length()+1) + ")";
|
joachim99@66
|
1242 }
|
joachim99@66
|
1243 }
|
joachim99@66
|
1244
|
joachim99@66
|
1245 pLanguage->insertItem( languageId );
|
joachim99@66
|
1246 }
|
joachim99@66
|
1247
|
joachim99@58
|
1248 QToolTip::add( label, i18n(
|
joachim99@58
|
1249 "Choose the language of the GUI-strings or \"Auto\".\n"
|
joachim99@58
|
1250 "For a change of language to take place, quit and restart KDiff3.")
|
joachim99@58
|
1251 );
|
joachim99@58
|
1252 ++line;
|
joachim99@66
|
1253 /*
|
joachim99@58
|
1254 label = new QLabel( i18n("Codec for file contents"), page );
|
joachim99@58
|
1255 gbox->addWidget( label, line, 0 );
|
joachim99@58
|
1256 OptionComboBox* pFileCodec = new OptionComboBox( 0, "FileCodec", &m_fileCodec, page, this );
|
joachim99@58
|
1257 gbox->addWidget( pFileCodec, line, 1 );
|
joachim99@58
|
1258 insertCodecs( pFileCodec );
|
joachim99@58
|
1259 QToolTip::add( label, i18n(
|
joachim99@58
|
1260 "Choose the codec that should be used for your input files\n"
|
joachim99@58
|
1261 "or \"Auto\" if unsure." )
|
joachim99@58
|
1262 );
|
joachim99@58
|
1263 ++line;
|
joachim99@66
|
1264 */
|
joachim99@68
|
1265 #endif
|
joachim99@68
|
1266
|
joachim99@68
|
1267 m_pSameEncoding = new OptionCheckBox( i18n("Use the same encoding for everything:"), true, "SameEncoding", &m_bSameEncoding, page, this );
|
joachim99@68
|
1268 gbox->addMultiCellWidget( m_pSameEncoding, line, line, 0, 1 );
|
joachim99@68
|
1269 QToolTip::add( m_pSameEncoding, i18n(
|
joachim99@68
|
1270 "Enable this allows to change all encodings by changing the first only.\n"
|
joachim99@68
|
1271 "Disable this if different individual settings are needed."
|
joachim99@68
|
1272 ) );
|
joachim99@68
|
1273 ++line;
|
joachim99@68
|
1274
|
joachim99@69
|
1275 label = new QLabel( i18n("Note: Local Encoding is ") + "\"" + QTextCodec::codecForLocale()->name() + "\"", page );
|
joachim99@68
|
1276 gbox->addWidget( label, line, 0 );
|
joachim99@68
|
1277 ++line;
|
joachim99@68
|
1278
|
joachim99@68
|
1279 label = new QLabel( i18n("File Encoding for A:"), page );
|
joachim99@68
|
1280 gbox->addWidget( label, line, 0 );
|
joachim99@68
|
1281 m_pEncodingAComboBox = new OptionEncodingComboBox( "EncodingForA", &m_pEncodingA, page, this );
|
joachim99@68
|
1282 gbox->addWidget( m_pEncodingAComboBox, line, 1 );
|
joachim99@68
|
1283 ++line;
|
joachim99@68
|
1284 label = new QLabel( i18n("File Encoding for B:"), page );
|
joachim99@68
|
1285 gbox->addWidget( label, line, 0 );
|
joachim99@68
|
1286 m_pEncodingBComboBox = new OptionEncodingComboBox( "EncodingForB", &m_pEncodingB, page, this );
|
joachim99@68
|
1287 gbox->addWidget( m_pEncodingBComboBox, line, 1 );
|
joachim99@68
|
1288 ++line;
|
joachim99@68
|
1289 label = new QLabel( i18n("File Encoding for C:"), page );
|
joachim99@68
|
1290 gbox->addWidget( label, line, 0 );
|
joachim99@68
|
1291 m_pEncodingCComboBox = new OptionEncodingComboBox( "EncodingForC", &m_pEncodingC, page, this );
|
joachim99@68
|
1292 gbox->addWidget( m_pEncodingCComboBox, line, 1 );
|
joachim99@68
|
1293 ++line;
|
joachim99@68
|
1294 label = new QLabel( i18n("File Encoding for Merge Output and Saving:"), page );
|
joachim99@68
|
1295 gbox->addWidget( label, line, 0 );
|
joachim99@68
|
1296 m_pEncodingOutComboBox = new OptionEncodingComboBox( "EncodingForOutput", &m_pEncodingOut, page, this );
|
joachim99@68
|
1297 gbox->addWidget( m_pEncodingOutComboBox, line, 1 );
|
joachim99@68
|
1298 ++line;
|
joachim99@68
|
1299 label = new QLabel( i18n("File Encoding for Preprocessor Files:"), page );
|
joachim99@68
|
1300 gbox->addWidget( label, line, 0 );
|
joachim99@68
|
1301 m_pEncodingPPComboBox = new OptionEncodingComboBox( "EncodingForPP", &m_pEncodingPP, page, this );
|
joachim99@68
|
1302 gbox->addWidget( m_pEncodingPPComboBox, line, 1 );
|
joachim99@68
|
1303 ++line;
|
joachim99@68
|
1304
|
joachim99@68
|
1305 connect(m_pSameEncoding, SIGNAL(toggled(bool)), this, SLOT(slotEncodingChanged()));
|
joachim99@68
|
1306 connect(m_pEncodingAComboBox, SIGNAL(activated(int)), this, SLOT(slotEncodingChanged()));
|
joachim99@68
|
1307
|
joachim99@68
|
1308 OptionCheckBox* pRightToLeftLanguage = new OptionCheckBox( i18n("Right To Left Language"), false, "RightToLeftLanguage", &m_bRightToLeftLanguage, page, this );
|
joachim99@68
|
1309 gbox->addMultiCellWidget( pRightToLeftLanguage, line, line, 0, 1 );
|
joachim99@68
|
1310 QToolTip::add( pRightToLeftLanguage, i18n(
|
joachim99@68
|
1311 "Some languages are read from right to left.\n"
|
joachim99@68
|
1312 "This setting will change the viewer and editor accordingly."));
|
joachim99@68
|
1313 ++line;
|
joachim99@68
|
1314
|
joachim99@68
|
1315
|
joachim99@58
|
1316 topLayout->addStretch(10);
|
joachim99@58
|
1317 }
|
joachim99@58
|
1318
|
joachim99@69
|
1319 void OptionDialog::setupIntegrationPage( void )
|
joachim99@69
|
1320 {
|
joachim99@69
|
1321 QFrame *page = addPage( i18n("Integration"), i18n("Integration Settings"),
|
joachim99@69
|
1322 BarIcon("launch"/*"charset"*/, KIcon::SizeMedium ) );
|
joachim99@69
|
1323 QVBoxLayout *topLayout = new QVBoxLayout( page, 5, spacingHint() );
|
joachim99@69
|
1324
|
joachim99@69
|
1325 QGridLayout *gbox = new QGridLayout( 3, 2 );
|
joachim99@69
|
1326 gbox->setColStretch(1,5);
|
joachim99@69
|
1327 topLayout->addLayout( gbox );
|
joachim99@69
|
1328 int line=0;
|
joachim99@69
|
1329
|
joachim99@69
|
1330 QLabel* label;
|
joachim99@69
|
1331 label = new QLabel( i18n("Command line options to ignore:"), page );
|
joachim99@69
|
1332 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
1333 OptionLineEdit* pIgnorableCmdLineOptions = new OptionLineEdit( "-u;-query;-html;-abort", "IgnorableCmdLineOptions", &m_ignorableCmdLineOptions, page, this );
|
joachim99@69
|
1334 gbox->addWidget( pIgnorableCmdLineOptions, line, 1 );
|
joachim99@69
|
1335 QToolTip::add( label, i18n(
|
joachim99@69
|
1336 "List of command line options that should be ignored when KDiff3 is used by other tools.\n"
|
joachim99@69
|
1337 "Several values can be specified if separated via ';'\n"
|
joachim99@69
|
1338 "This will suppress the \"Unknown option\"-error."
|
joachim99@69
|
1339 ));
|
joachim99@69
|
1340 ++line;
|
joachim99@69
|
1341
|
joachim99@69
|
1342 topLayout->addStretch(10);
|
joachim99@69
|
1343 }
|
joachim99@69
|
1344
|
joachim99@69
|
1345
|
joachim99@68
|
1346 void OptionDialog::slotEncodingChanged()
|
joachim99@68
|
1347 {
|
joachim99@68
|
1348 if ( m_pSameEncoding->isChecked() )
|
joachim99@68
|
1349 {
|
joachim99@68
|
1350 m_pEncodingBComboBox->setEnabled( false );
|
joachim99@68
|
1351 m_pEncodingBComboBox->setCurrentItem( m_pEncodingAComboBox->currentItem() );
|
joachim99@68
|
1352 m_pEncodingCComboBox->setEnabled( false );
|
joachim99@68
|
1353 m_pEncodingCComboBox->setCurrentItem( m_pEncodingAComboBox->currentItem() );
|
joachim99@68
|
1354 m_pEncodingOutComboBox->setEnabled( false );
|
joachim99@68
|
1355 m_pEncodingOutComboBox->setCurrentItem( m_pEncodingAComboBox->currentItem() );
|
joachim99@68
|
1356 m_pEncodingPPComboBox->setEnabled( false );
|
joachim99@68
|
1357 m_pEncodingPPComboBox->setCurrentItem( m_pEncodingAComboBox->currentItem() );
|
joachim99@68
|
1358 }
|
joachim99@68
|
1359 else
|
joachim99@68
|
1360 {
|
joachim99@68
|
1361 m_pEncodingBComboBox->setEnabled( true );
|
joachim99@68
|
1362 m_pEncodingCComboBox->setEnabled( true );
|
joachim99@68
|
1363 m_pEncodingOutComboBox->setEnabled( true );
|
joachim99@68
|
1364 m_pEncodingPPComboBox->setEnabled( true );
|
joachim99@68
|
1365 }
|
joachim99@68
|
1366 }
|
joachim99@58
|
1367
|
joachim99@8
|
1368 void OptionDialog::setupKeysPage( void )
|
joachim99@8
|
1369 {
|
joachim99@8
|
1370 //QVBox *page = addVBoxPage( i18n("Keys"), i18n("KeyDialog" ),
|
joachim99@8
|
1371 // BarIcon("fonts", KIcon::SizeMedium ) );
|
joachim99@8
|
1372
|
joachim99@8
|
1373 //QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
|
joachim99@8
|
1374 // new KFontChooser( page,"font",false/*onlyFixed*/,QStringList(),false,6 );
|
joachim99@8
|
1375 //m_pKeyDialog=new KKeyDialog( false, 0 );
|
joachim99@8
|
1376 //topLayout->addWidget( m_pKeyDialog );
|
joachim99@8
|
1377 }
|
joachim99@8
|
1378
|
joachim99@8
|
1379 void OptionDialog::slotOk( void )
|
joachim99@8
|
1380 {
|
joachim99@8
|
1381 slotApply();
|
joachim99@8
|
1382
|
joachim99@8
|
1383 // My system returns variable width fonts even though I
|
joachim99@8
|
1384 // disabled this. Even QFont::fixedPitch() doesn't work.
|
joachim99@8
|
1385 QFontMetrics fm(m_font);
|
joachim99@8
|
1386 if ( fm.width('W')!=fm.width('i') )
|
joachim99@8
|
1387 {
|
joachim99@8
|
1388 int result = KMessageBox::warningYesNo(this, i18n(
|
joachim99@8
|
1389 "You selected a variable width font.\n\n"
|
joachim99@8
|
1390 "Because this program doesn't handle variable width fonts\n"
|
joachim99@8
|
1391 "correctly, you might experience problems while editing.\n\n"
|
joachim99@8
|
1392 "Do you want to continue or do you want to select another font."),
|
joachim99@51
|
1393 i18n("Incompatible Font"),
|
joachim99@51
|
1394 i18n("Continue at Own Risk"), i18n("Select Another Font"));
|
joachim99@8
|
1395 if (result==KMessageBox::No)
|
joachim99@8
|
1396 return;
|
joachim99@8
|
1397 }
|
joachim99@8
|
1398
|
joachim99@8
|
1399 accept();
|
joachim99@8
|
1400 }
|
joachim99@8
|
1401
|
joachim99@8
|
1402
|
joachim99@8
|
1403 /** Copy the values from the widgets to the public variables.*/
|
joachim99@8
|
1404 void OptionDialog::slotApply( void )
|
joachim99@8
|
1405 {
|
joachim99@8
|
1406 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
1407 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
1408 {
|
joachim99@8
|
1409 (*i)->apply();
|
joachim99@8
|
1410 }
|
joachim99@8
|
1411
|
joachim99@8
|
1412 emit applyClicked();
|
joachim99@8
|
1413 }
|
joachim99@8
|
1414
|
joachim99@8
|
1415 /** Set the default values in the widgets only, while the
|
joachim99@8
|
1416 public variables remain unchanged. */
|
joachim99@8
|
1417 void OptionDialog::slotDefault()
|
joachim99@8
|
1418 {
|
joachim99@8
|
1419 int result = KMessageBox::warningContinueCancel(this, i18n("This resets all options. Not only those of the current topic.") );
|
joachim99@8
|
1420 if ( result==KMessageBox::Cancel ) return;
|
joachim99@8
|
1421 else resetToDefaults();
|
joachim99@8
|
1422 }
|
joachim99@8
|
1423
|
joachim99@8
|
1424 void OptionDialog::resetToDefaults()
|
joachim99@69
|
1425 {
|
joachim99@8
|
1426 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
1427 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
1428 {
|
joachim99@8
|
1429 (*i)->setToDefault();
|
joachim99@8
|
1430 }
|
joachim99@8
|
1431
|
joachim99@68
|
1432 slotEncodingChanged();
|
joachim99@8
|
1433 }
|
joachim99@8
|
1434
|
joachim99@8
|
1435 /** Initialise the widgets using the values in the public varibles. */
|
joachim99@8
|
1436 void OptionDialog::setState()
|
joachim99@8
|
1437 {
|
joachim99@8
|
1438 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
1439 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
1440 {
|
joachim99@8
|
1441 (*i)->setToCurrent();
|
joachim99@8
|
1442 }
|
joachim99@8
|
1443
|
joachim99@68
|
1444 slotEncodingChanged();
|
joachim99@8
|
1445 }
|
joachim99@8
|
1446
|
joachim99@69
|
1447 class ConfigValueMap : public ValueMap
|
joachim99@69
|
1448 {
|
joachim99@69
|
1449 private:
|
joachim99@69
|
1450 KConfig* m_pConfig;
|
joachim99@69
|
1451 public:
|
joachim99@69
|
1452 ConfigValueMap( KConfig* pConfig ) { m_pConfig = pConfig; }
|
joachim99@69
|
1453
|
joachim99@69
|
1454 void writeEntry(const QString& s, const QFont& v ){ m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1455 void writeEntry(const QString& s, const QColor& v ){ m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1456 void writeEntry(const QString& s, const QSize& v ){ m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1457 void writeEntry(const QString& s, const QPoint& v ){ m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1458 void writeEntry(const QString& s, int v ) { m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1459 void writeEntry(const QString& s, bool v ) { m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1460 void writeEntry(const QString& s, const QStringList& v, char separator ){ m_pConfig->writeEntry(s,v,separator); }
|
joachim99@69
|
1461 void writeEntry(const QString& s, const QString& v ){ m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1462 void writeEntry(const QString& s, const char* v ) { m_pConfig->writeEntry(s,v); }
|
joachim99@69
|
1463
|
joachim99@69
|
1464 QFont readFontEntry (const QString& s, QFont* defaultVal ) { return m_pConfig->readFontEntry(s,defaultVal); }
|
joachim99@69
|
1465 QColor readColorEntry(const QString& s, QColor* defaultVal ){ return m_pConfig->readColorEntry(s,defaultVal); }
|
joachim99@69
|
1466 QSize readSizeEntry (const QString& s, QSize* defaultVal ) { return m_pConfig->readSizeEntry(s,defaultVal); }
|
joachim99@69
|
1467 QPoint readPointEntry(const QString& s, QPoint* defaultVal) { return m_pConfig->readPointEntry(s,defaultVal); }
|
joachim99@69
|
1468 bool readBoolEntry (const QString& s, bool defaultVal ) { return m_pConfig->readBoolEntry(s,defaultVal); }
|
joachim99@69
|
1469 int readNumEntry (const QString& s, int defaultVal ) { return m_pConfig->readNumEntry(s,defaultVal); }
|
joachim99@69
|
1470 QStringList readListEntry (const QString& s, const QStringList& def, char separator ) { return m_pConfig->readListEntry(s.latin1(),def,separator); }
|
joachim99@69
|
1471 QString readEntry (const QString& s, const QString& defaultVal){ return m_pConfig->readEntry(s,defaultVal); }
|
joachim99@69
|
1472 };
|
joachim99@69
|
1473
|
joachim99@8
|
1474 void OptionDialog::saveOptions( KConfig* config )
|
joachim99@8
|
1475 {
|
joachim99@8
|
1476 // No i18n()-Translations here!
|
joachim99@8
|
1477
|
joachim99@8
|
1478 config->setGroup("KDiff3 Options");
|
joachim99@8
|
1479
|
joachim99@69
|
1480 ConfigValueMap cvm(config);
|
joachim99@8
|
1481 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
1482 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
1483 {
|
joachim99@69
|
1484 (*i)->write(&cvm);
|
joachim99@8
|
1485 }
|
joachim99@8
|
1486 }
|
joachim99@8
|
1487
|
joachim99@8
|
1488 void OptionDialog::readOptions( KConfig* config )
|
joachim99@8
|
1489 {
|
joachim99@8
|
1490 // No i18n()-Translations here!
|
joachim99@8
|
1491
|
joachim99@8
|
1492 config->setGroup("KDiff3 Options");
|
joachim99@8
|
1493
|
joachim99@69
|
1494 ConfigValueMap cvm(config);
|
joachim99@8
|
1495 std::list<OptionItem*>::iterator i;
|
joachim99@8
|
1496 for(i=m_optionItemList.begin(); i!=m_optionItemList.end(); ++i)
|
joachim99@8
|
1497 {
|
joachim99@69
|
1498 (*i)->read(&cvm);
|
joachim99@8
|
1499 }
|
joachim99@8
|
1500
|
joachim99@8
|
1501 setState();
|
joachim99@8
|
1502 }
|
joachim99@8
|
1503
|
joachim99@8
|
1504 void OptionDialog::slotHelp( void )
|
joachim99@8
|
1505 {
|
joachim99@8
|
1506 KDialogBase::slotHelp();
|
joachim99@8
|
1507 }
|
joachim99@8
|
1508
|
joachim99@69
|
1509 QString OptionDialog::parseOptions( const QCStringList& optionList )
|
joachim99@69
|
1510 {
|
joachim99@69
|
1511 QString result;
|
joachim99@69
|
1512 QCStringList::const_iterator i;
|
joachim99@69
|
1513 for ( i=optionList.begin(); i!=optionList.end(); ++i )
|
joachim99@69
|
1514 {
|
joachim99@69
|
1515 QString s = *i;
|
joachim99@69
|
1516
|
joachim99@69
|
1517 int pos = s.find('=');
|
joachim99@69
|
1518 if( pos > 0 ) // seems not to have a tag
|
joachim99@69
|
1519 {
|
joachim99@69
|
1520 QString key = s.left(pos);
|
joachim99@69
|
1521 QString val = s.mid(pos+1);
|
joachim99@69
|
1522 std::list<OptionItem*>::iterator j;
|
joachim99@69
|
1523 bool bFound = false;
|
joachim99@69
|
1524 for(j=m_optionItemList.begin(); j!=m_optionItemList.end(); ++j)
|
joachim99@69
|
1525 {
|
joachim99@69
|
1526 if ( (*j)->getSaveName()==key )
|
joachim99@69
|
1527 {
|
joachim99@69
|
1528 ValueMap config;
|
joachim99@69
|
1529 config.writeEntry( key, val ); // Write the value as a string and
|
joachim99@69
|
1530 (*j)->read(&config); // use the internal conversion from string to the needed value.
|
joachim99@69
|
1531 bFound = true;
|
joachim99@69
|
1532 break;
|
joachim99@69
|
1533 }
|
joachim99@69
|
1534 }
|
joachim99@69
|
1535 if ( ! bFound )
|
joachim99@69
|
1536 {
|
joachim99@69
|
1537 result += "No config item named \"" + key + "\"\n";
|
joachim99@69
|
1538 }
|
joachim99@69
|
1539 }
|
joachim99@69
|
1540 else
|
joachim99@69
|
1541 {
|
joachim99@69
|
1542 result += "No '=' found in \"" + s + "\"\n";
|
joachim99@69
|
1543 }
|
joachim99@69
|
1544 }
|
joachim99@69
|
1545 return result;
|
joachim99@69
|
1546 }
|
joachim99@69
|
1547
|
joachim99@69
|
1548 QString OptionDialog::calcOptionHelp()
|
joachim99@69
|
1549 {
|
joachim99@69
|
1550 ValueMap config;
|
joachim99@69
|
1551 std::list<OptionItem*>::iterator j;
|
joachim99@69
|
1552 for(j=m_optionItemList.begin(); j!=m_optionItemList.end(); ++j)
|
joachim99@69
|
1553 {
|
joachim99@69
|
1554 (*j)->write( &config );
|
joachim99@69
|
1555 }
|
joachim99@69
|
1556 return config.getAsString();
|
joachim99@69
|
1557 }
|
joachim99@69
|
1558
|
joachim99@69
|
1559 void OptionDialog::slotHistoryMergeRegExpTester()
|
joachim99@69
|
1560 {
|
joachim99@69
|
1561 RegExpTester dlg(this, s_autoMergeRegExpToolTip, s_historyStartRegExpToolTip,
|
joachim99@69
|
1562 s_historyEntryStartRegExpToolTip, s_historyEntryStartSortKeyOrderToolTip );
|
joachim99@69
|
1563 dlg.init(m_pAutoMergeRegExpLineEdit->currentText(), m_pHistoryStartRegExpLineEdit->currentText(),
|
joachim99@69
|
1564 m_pHistoryEntryStartRegExpLineEdit->currentText(), m_pHistorySortKeyOrderLineEdit->currentText());
|
joachim99@69
|
1565 if ( dlg.exec() )
|
joachim99@69
|
1566 {
|
joachim99@69
|
1567 m_pAutoMergeRegExpLineEdit->setCurrentText( dlg.autoMergeRegExp() );
|
joachim99@69
|
1568 m_pHistoryStartRegExpLineEdit->setCurrentText( dlg.historyStartRegExp() );
|
joachim99@69
|
1569 m_pHistoryEntryStartRegExpLineEdit->setCurrentText( dlg.historyEntryStartRegExp() );
|
joachim99@69
|
1570 m_pHistorySortKeyOrderLineEdit->setCurrentText( dlg.historySortKeyOrder() );
|
joachim99@69
|
1571 }
|
joachim99@69
|
1572 }
|
joachim99@69
|
1573
|
joachim99@69
|
1574
|
joachim99@8
|
1575 #include "optiondialog.moc"
|