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@73
|
24 #include <QFrame>
|
joachim99@8
|
25 #include <qlayout.h>
|
joachim99@8
|
26 #include <qlabel.h>
|
joachim99@8
|
27 #include <qlineedit.h>
|
joachim99@70
|
28 #include <q3vbox.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@70
|
33 #include <Q3VButtonGroup>
|
joachim99@70
|
34 //Added by qt3to4:
|
joachim99@70
|
35 #include <Q3GridLayout>
|
joachim99@70
|
36 #include <Q3VBoxLayout>
|
joachim99@8
|
37
|
joachim99@8
|
38 #include <kapplication.h>
|
joachim99@8
|
39 #include <kcolorbtn.h>
|
joachim99@8
|
40 #include <kfontdialog.h> // For KFontChooser
|
joachim99@8
|
41 #include <kiconloader.h>
|
joachim99@8
|
42 #include <klocale.h>
|
joachim99@8
|
43 #include <kconfig.h>
|
joachim99@8
|
44 #include <kmessagebox.h>
|
joachim99@69
|
45 #include <kmainwindow.h> //For ktoolbar.h
|
joachim99@69
|
46
|
joachim99@8
|
47 //#include <kkeydialog.h>
|
joachim99@58
|
48 #include <map>
|
joachim99@8
|
49
|
joachim99@8
|
50 #include "optiondialog.h"
|
joachim99@8
|
51 #include "diff.h"
|
joachim99@69
|
52 #include "smalldialogs.h"
|
joachim99@69
|
53
|
joachim99@69
|
54 #include <iostream>
|
joachim99@8
|
55
|
joachim99@66
|
56 #ifndef KREPLACEMENTS_H
|
joachim99@66
|
57 #include <kglobalsettings.h>
|
joachim99@66
|
58 #endif
|
joachim99@66
|
59
|
joachim99@69
|
60 static QString s_historyEntryStartRegExpToolTip;
|
joachim99@69
|
61 static QString s_historyEntryStartSortKeyOrderToolTip;
|
joachim99@69
|
62 static QString s_autoMergeRegExpToolTip;
|
joachim99@69
|
63 static QString s_historyStartRegExpToolTip;
|
joachim99@69
|
64
|
joachim99@8
|
65 void OptionDialog::addOptionItem(OptionItem* p)
|
joachim99@8
|
66 {
|
joachim99@8
|
67 m_optionItemList.push_back(p);
|
joachim99@8
|
68 }
|
joachim99@8
|
69
|
joachim99@8
|
70 class OptionItem
|
joachim99@8
|
71 {
|
joachim99@8
|
72 public:
|
joachim99@69
|
73 OptionItem( OptionDialog* pOptionDialog, const QString& saveName )
|
joachim99@8
|
74 {
|
joachim99@8
|
75 assert(pOptionDialog!=0);
|
joachim99@8
|
76 pOptionDialog->addOptionItem( this );
|
joachim99@8
|
77 m_saveName = saveName;
|
joachim99@8
|
78 }
|
joachim99@8
|
79 virtual ~OptionItem(){}
|
joachim99@8
|
80 virtual void setToDefault()=0;
|
joachim99@8
|
81 virtual void setToCurrent()=0;
|
joachim99@8
|
82 virtual void apply()=0;
|
joachim99@69
|
83 virtual void write(ValueMap*)=0;
|
joachim99@69
|
84 virtual void read(ValueMap*)=0;
|
joachim99@69
|
85 QString getSaveName(){return m_saveName;}
|
joachim99@8
|
86 protected:
|
joachim99@8
|
87 QString m_saveName;
|
joachim99@8
|
88 };
|
joachim99@8
|
89
|
joachim99@8
|
90 class OptionCheckBox : public QCheckBox, public OptionItem
|
joachim99@8
|
91 {
|
joachim99@8
|
92 public:
|
joachim99@8
|
93 OptionCheckBox( QString text, bool bDefaultVal, const QString& saveName, bool* pbVar,
|
joachim99@8
|
94 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
95 : QCheckBox( text, pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
96 {
|
joachim99@8
|
97 m_pbVar = pbVar;
|
joachim99@8
|
98 m_bDefaultVal = bDefaultVal;
|
joachim99@8
|
99 }
|
joachim99@8
|
100 void setToDefault(){ setChecked( m_bDefaultVal ); }
|
joachim99@8
|
101 void setToCurrent(){ setChecked( *m_pbVar ); }
|
joachim99@8
|
102 void apply() { *m_pbVar = isChecked(); }
|
joachim99@69
|
103 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@69
|
104 void read (ValueMap* config){ *m_pbVar = config->readBoolEntry( m_saveName, *m_pbVar ); }
|
joachim99@8
|
105 private:
|
joachim99@8
|
106 OptionCheckBox( const OptionCheckBox& ); // private copy constructor without implementation
|
joachim99@8
|
107 bool* m_pbVar;
|
joachim99@8
|
108 bool m_bDefaultVal;
|
joachim99@8
|
109 };
|
joachim99@8
|
110
|
joachim99@66
|
111 class OptionRadioButton : public QRadioButton, public OptionItem
|
joachim99@66
|
112 {
|
joachim99@66
|
113 public:
|
joachim99@66
|
114 OptionRadioButton( QString text, bool bDefaultVal, const QString& saveName, bool* pbVar,
|
joachim99@66
|
115 QWidget* pParent, OptionDialog* pOD )
|
joachim99@66
|
116 : QRadioButton( text, pParent ), OptionItem( pOD, saveName )
|
joachim99@66
|
117 {
|
joachim99@66
|
118 m_pbVar = pbVar;
|
joachim99@66
|
119 m_bDefaultVal = bDefaultVal;
|
joachim99@66
|
120 }
|
joachim99@66
|
121 void setToDefault(){ setChecked( m_bDefaultVal ); }
|
joachim99@66
|
122 void setToCurrent(){ setChecked( *m_pbVar ); }
|
joachim99@66
|
123 void apply() { *m_pbVar = isChecked(); }
|
joachim99@69
|
124 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@69
|
125 void read (ValueMap* config){ *m_pbVar = config->readBoolEntry( m_saveName, *m_pbVar ); }
|
joachim99@66
|
126 private:
|
joachim99@66
|
127 OptionRadioButton( const OptionRadioButton& ); // private copy constructor without implementation
|
joachim99@66
|
128 bool* m_pbVar;
|
joachim99@66
|
129 bool m_bDefaultVal;
|
joachim99@66
|
130 };
|
joachim99@66
|
131
|
joachim99@69
|
132
|
joachim99@69
|
133 template<class T>
|
joachim99@69
|
134 class OptionT : public OptionItem
|
joachim99@51
|
135 {
|
joachim99@51
|
136 public:
|
joachim99@69
|
137 OptionT( const T& defaultVal, const QString& saveName, T* pVar, OptionDialog* pOD )
|
joachim99@51
|
138 : OptionItem( pOD, saveName )
|
joachim99@51
|
139 {
|
joachim99@69
|
140 m_pVar = pVar;
|
joachim99@69
|
141 *m_pVar = defaultVal;
|
joachim99@69
|
142 }
|
joachim99@69
|
143 OptionT( const QString& saveName, T* pVar, OptionDialog* pOD )
|
joachim99@69
|
144 : OptionItem( pOD, saveName )
|
joachim99@69
|
145 {
|
joachim99@69
|
146 m_pVar = pVar;
|
joachim99@51
|
147 }
|
joachim99@51
|
148 void setToDefault(){}
|
joachim99@51
|
149 void setToCurrent(){}
|
joachim99@51
|
150 void apply() {}
|
joachim99@69
|
151 void write(ValueMap* vm){ writeEntry( vm, m_saveName, *m_pVar ); }
|
joachim99@69
|
152 void read (ValueMap* vm){ readEntry ( vm, m_saveName, *m_pVar ); }
|
joachim99@51
|
153 private:
|
joachim99@69
|
154 OptionT( const OptionT& ); // private copy constructor without implementation
|
joachim99@69
|
155 T* m_pVar;
|
joachim99@51
|
156 };
|
joachim99@51
|
157
|
joachim99@69
|
158 template <class T> void writeEntry(ValueMap* vm, const QString& saveName, const T& v ) { vm->writeEntry( saveName, v ); }
|
joachim99@69
|
159 static void writeEntry(ValueMap* vm, const QString& saveName, const QStringList& v ) { vm->writeEntry( saveName, v, '|' ); }
|
joachim99@69
|
160
|
joachim99@69
|
161 static void readEntry(ValueMap* vm, const QString& saveName, bool& v ) { v = vm->readBoolEntry( saveName, v ); }
|
joachim99@69
|
162 static void readEntry(ValueMap* vm, const QString& saveName, int& v ) { v = vm->readNumEntry( saveName, v ); }
|
joachim99@69
|
163 static void readEntry(ValueMap* vm, const QString& saveName, QSize& v ) { v = vm->readSizeEntry( saveName, &v ); }
|
joachim99@69
|
164 static void readEntry(ValueMap* vm, const QString& saveName, QPoint& v ) { v = vm->readPointEntry( saveName, &v ); }
|
joachim99@69
|
165 static void readEntry(ValueMap* vm, const QString& saveName, QStringList& v ){ v = vm->readListEntry( saveName, QStringList(), '|' ); }
|
joachim99@69
|
166
|
joachim99@69
|
167 typedef OptionT<bool> OptionToggleAction;
|
joachim99@69
|
168 typedef OptionT<int> OptionNum;
|
joachim99@69
|
169 typedef OptionT<QPoint> OptionPoint;
|
joachim99@69
|
170 typedef OptionT<QSize> OptionSize;
|
joachim99@69
|
171 typedef OptionT<QStringList> OptionStringList;
|
joachim99@69
|
172
|
joachim99@69
|
173 class OptionFontChooser : public KFontChooser, public OptionItem
|
joachim99@69
|
174 {
|
joachim99@69
|
175 public:
|
joachim99@69
|
176 OptionFontChooser( const QFont& defaultVal, const QString& saveName, QFont* pbVar, QWidget* pParent, OptionDialog* pOD )
|
joachim99@69
|
177 :KFontChooser( pParent,"font",true/*onlyFixed*/,QStringList(),false,6 ),
|
joachim99@69
|
178 OptionItem( pOD, saveName )
|
joachim99@69
|
179 {
|
joachim99@69
|
180 m_pbVar = pbVar;
|
joachim99@69
|
181 *m_pbVar = defaultVal;
|
joachim99@69
|
182 m_default = defaultVal;
|
joachim99@69
|
183 }
|
joachim99@69
|
184 void setToDefault(){ setFont( m_default, true /*only fixed*/ ); }
|
joachim99@69
|
185 void setToCurrent(){ setFont( *m_pbVar, true /*only fixed*/ ); }
|
joachim99@69
|
186 void apply() { *m_pbVar = font();}
|
joachim99@69
|
187 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pbVar ); }
|
joachim99@69
|
188 void read (ValueMap* config){ *m_pbVar = config->readFontEntry( m_saveName, m_pbVar ); }
|
joachim99@69
|
189 private:
|
joachim99@69
|
190 OptionFontChooser( const OptionToggleAction& ); // private copy constructor without implementation
|
joachim99@69
|
191 QFont* m_pbVar;
|
joachim99@69
|
192 QFont m_default;
|
joachim99@69
|
193 };
|
joachim99@51
|
194
|
joachim99@8
|
195 class OptionColorButton : public KColorButton, public OptionItem
|
joachim99@8
|
196 {
|
joachim99@8
|
197 public:
|
joachim99@8
|
198 OptionColorButton( QColor defaultVal, const QString& saveName, QColor* pVar, QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
199 : KColorButton( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
200 {
|
joachim99@8
|
201 m_pVar = pVar;
|
joachim99@8
|
202 m_defaultVal = defaultVal;
|
joachim99@8
|
203 }
|
joachim99@8
|
204 void setToDefault(){ setColor( m_defaultVal ); }
|
joachim99@8
|
205 void setToCurrent(){ setColor( *m_pVar ); }
|
joachim99@8
|
206 void apply() { *m_pVar = color(); }
|
joachim99@69
|
207 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@69
|
208 void read (ValueMap* config){ *m_pVar = config->readColorEntry( m_saveName, m_pVar ); }
|
joachim99@8
|
209 private:
|
joachim99@8
|
210 OptionColorButton( const OptionColorButton& ); // private copy constructor without implementation
|
joachim99@8
|
211 QColor* m_pVar;
|
joachim99@8
|
212 QColor m_defaultVal;
|
joachim99@8
|
213 };
|
joachim99@8
|
214
|
joachim99@58
|
215 class OptionLineEdit : public QComboBox, public OptionItem
|
joachim99@8
|
216 {
|
joachim99@8
|
217 public:
|
joachim99@8
|
218 OptionLineEdit( const QString& defaultVal, const QString& saveName, QString* pVar,
|
joachim99@8
|
219 QWidget* pParent, OptionDialog* pOD )
|
joachim99@58
|
220 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
221 {
|
joachim99@69
|
222 setMinimumWidth(50);
|
joachim99@69
|
223 setEditable(true);
|
joachim99@8
|
224 m_pVar = pVar;
|
joachim99@8
|
225 m_defaultVal = defaultVal;
|
joachim99@58
|
226 m_list.push_back(defaultVal);
|
joachim99@69
|
227 insertText();
|
joachim99@8
|
228 }
|
joachim99@69
|
229 void setToDefault(){ setCurrentText( m_defaultVal ); }
|
joachim99@69
|
230 void setToCurrent(){ setCurrentText( *m_pVar ); }
|
joachim99@58
|
231 void apply() { *m_pVar = currentText(); insertText(); }
|
joachim99@69
|
232 void write(ValueMap* config){ config->writeEntry( m_saveName, m_list, '|' ); }
|
joachim99@69
|
233 void read (ValueMap* config){
|
joachim99@70
|
234 m_list = config->readListEntry( m_saveName, QStringList(m_defaultVal), '|' );
|
joachim99@69
|
235 if ( !m_list.empty() ) *m_pVar = m_list.front();
|
joachim99@58
|
236 clear();
|
joachim99@58
|
237 insertStringList(m_list);
|
joachim99@58
|
238 }
|
joachim99@8
|
239 private:
|
joachim99@58
|
240 void insertText()
|
joachim99@69
|
241 { // Check if the text exists. If yes remove it and push it in as first element
|
joachim99@58
|
242 QString current = currentText();
|
joachim99@58
|
243 m_list.remove( current );
|
joachim99@58
|
244 m_list.push_front( current );
|
joachim99@58
|
245 clear();
|
joachim99@69
|
246 if ( m_list.size()>10 )
|
joachim99@70
|
247 m_list.erase( m_list.begin()+10, m_list.end() );
|
joachim99@58
|
248 insertStringList(m_list);
|
joachim99@58
|
249 }
|
joachim99@8
|
250 OptionLineEdit( const OptionLineEdit& ); // private copy constructor without implementation
|
joachim99@8
|
251 QString* m_pVar;
|
joachim99@8
|
252 QString m_defaultVal;
|
joachim99@58
|
253 QStringList m_list;
|
joachim99@8
|
254 };
|
joachim99@8
|
255
|
joachim99@8
|
256 #if defined QT_NO_VALIDATOR
|
joachim99@8
|
257 #error No validator
|
joachim99@8
|
258 #endif
|
joachim99@8
|
259 class OptionIntEdit : public QLineEdit, public OptionItem
|
joachim99@8
|
260 {
|
joachim99@8
|
261 public:
|
joachim99@8
|
262 OptionIntEdit( int defaultVal, const QString& saveName, int* pVar, int rangeMin, int rangeMax,
|
joachim99@8
|
263 QWidget* pParent, OptionDialog* pOD )
|
joachim99@8
|
264 : QLineEdit( pParent ), OptionItem( pOD, saveName )
|
joachim99@8
|
265 {
|
joachim99@8
|
266 m_pVar = pVar;
|
joachim99@8
|
267 m_defaultVal = defaultVal;
|
joachim99@51
|
268 QIntValidator* v = new QIntValidator(this);
|
joachim99@8
|
269 v->setRange( rangeMin, rangeMax );
|
joachim99@8
|
270 setValidator( v );
|
joachim99@8
|
271 }
|
joachim99@8
|
272 void setToDefault(){ QString s; s.setNum(m_defaultVal); setText( s ); }
|
joachim99@8
|
273 void setToCurrent(){ QString s; s.setNum(*m_pVar); setText( s ); }
|
joachim99@8
|
274 void apply() { const QIntValidator* v=static_cast<const QIntValidator*>(validator());
|
joachim99@8
|
275 *m_pVar = minMaxLimiter( text().toInt(), v->bottom(), v->top());
|
joachim99@8
|
276 setText( QString::number(*m_pVar) ); }
|
joachim99@69
|
277 void write(ValueMap* config){ config->writeEntry(m_saveName, *m_pVar ); }
|
joachim99@69
|
278 void read (ValueMap* config){ *m_pVar = config->readNumEntry( m_saveName, *m_pVar ); }
|
joachim99@8
|
279 private:
|
joachim99@8
|
280 OptionIntEdit( const OptionIntEdit& ); // private copy constructor without implementation
|
joachim99@8
|
281 int* m_pVar;
|
joachim99@8
|
282 int m_defaultVal;
|
joachim99@8
|
283 };
|
joachim99@8
|
284
|
joachim99@51
|
285 class OptionComboBox : public QComboBox, public OptionItem
|
joachim99@51
|
286 {
|
joachim99@51
|
287 public:
|
joachim99@58
|
288 OptionComboBox( int defaultVal, const QString& saveName, int* pVarNum,
|
joachim99@51
|
289 QWidget* pParent, OptionDialog* pOD )
|
joachim99@51
|
290 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@51
|
291 {
|
joachim99@69
|
292 setMinimumWidth(50);
|
joachim99@58
|
293 m_pVarNum = pVarNum;
|
joachim99@58
|
294 m_pVarStr = 0;
|
joachim99@51
|
295 m_defaultVal = defaultVal;
|
joachim99@51
|
296 setEditable(false);
|
joachim99@51
|
297 }
|
joachim99@58
|
298 OptionComboBox( int defaultVal, const QString& saveName, QString* pVarStr,
|
joachim99@58
|
299 QWidget* pParent, OptionDialog* pOD )
|
joachim99@58
|
300 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@58
|
301 {
|
joachim99@58
|
302 m_pVarNum = 0;
|
joachim99@58
|
303 m_pVarStr = pVarStr;
|
joachim99@58
|
304 m_defaultVal = defaultVal;
|
joachim99@58
|
305 setEditable(false);
|
joachim99@58
|
306 }
|
joachim99@58
|
307 void setToDefault()
|
joachim99@58
|
308 {
|
joachim99@58
|
309 setCurrentItem( m_defaultVal );
|
joachim99@58
|
310 if (m_pVarStr!=0){ *m_pVarStr=currentText(); }
|
joachim99@58
|
311 }
|
joachim99@58
|
312 void setToCurrent()
|
joachim99@58
|
313 {
|
joachim99@58
|
314 if (m_pVarNum!=0) setCurrentItem( *m_pVarNum );
|
joachim99@58
|
315 else setText( *m_pVarStr );
|
joachim99@58
|
316 }
|
joachim99@69
|
317 void apply()
|
joachim99@58
|
318 {
|
joachim99@58
|
319 if (m_pVarNum!=0){ *m_pVarNum = currentItem(); }
|
joachim99@58
|
320 else { *m_pVarStr = currentText(); }
|
joachim99@58
|
321 }
|
joachim99@69
|
322 void write(ValueMap* config)
|
joachim99@58
|
323 {
|
joachim99@58
|
324 if (m_pVarStr!=0) config->writeEntry(m_saveName, *m_pVarStr );
|
joachim99@58
|
325 else config->writeEntry(m_saveName, *m_pVarNum );
|
joachim99@58
|
326 }
|
joachim99@69
|
327 void read (ValueMap* config)
|
joachim99@58
|
328 {
|
joachim99@58
|
329 if (m_pVarStr!=0) setText( config->readEntry( m_saveName, currentText() ) );
|
joachim99@58
|
330 else *m_pVarNum = config->readNumEntry( m_saveName, *m_pVarNum );
|
joachim99@58
|
331 }
|
joachim99@51
|
332 private:
|
joachim99@51
|
333 OptionComboBox( const OptionIntEdit& ); // private copy constructor without implementation
|
joachim99@58
|
334 int* m_pVarNum;
|
joachim99@58
|
335 QString* m_pVarStr;
|
joachim99@51
|
336 int m_defaultVal;
|
joachim99@58
|
337
|
joachim99@58
|
338 void setText(const QString& s)
|
joachim99@58
|
339 {
|
joachim99@58
|
340 // Find the string in the combobox-list, don't change the value if nothing fits.
|
joachim99@58
|
341 for( int i=0; i<count(); ++i )
|
joachim99@58
|
342 {
|
joachim99@58
|
343 if ( text(i)==s )
|
joachim99@58
|
344 {
|
joachim99@58
|
345 if (m_pVarNum!=0) *m_pVarNum = i;
|
joachim99@58
|
346 if (m_pVarStr!=0) *m_pVarStr = s;
|
joachim99@58
|
347 setCurrentItem(i);
|
joachim99@58
|
348 return;
|
joachim99@58
|
349 }
|
joachim99@58
|
350 }
|
joachim99@58
|
351 }
|
joachim99@51
|
352 };
|
joachim99@8
|
353
|
joachim99@68
|
354 class OptionEncodingComboBox : public QComboBox, public OptionItem
|
joachim99@68
|
355 {
|
joachim99@68
|
356 std::vector<QTextCodec*> m_codecVec;
|
joachim99@68
|
357 QTextCodec** m_ppVarCodec;
|
joachim99@68
|
358 public:
|
joachim99@68
|
359 OptionEncodingComboBox( const QString& saveName, QTextCodec** ppVarCodec,
|
joachim99@68
|
360 QWidget* pParent, OptionDialog* pOD )
|
joachim99@68
|
361 : QComboBox( pParent ), OptionItem( pOD, saveName )
|
joachim99@68
|
362 {
|
joachim99@68
|
363 m_ppVarCodec = ppVarCodec;
|
joachim99@68
|
364 insertCodec( i18n("Unicode, 8 bit"), QTextCodec::codecForName("UTF-8") );
|
joachim99@68
|
365 insertCodec( i18n("Unicode"), QTextCodec::codecForName("iso-10646-UCS-2") );
|
joachim99@68
|
366 insertCodec( i18n("Latin1"), QTextCodec::codecForName("iso 8859-1") );
|
joachim99@68
|
367
|
joachim99@68
|
368 // First sort codec names:
|
joachim99@68
|
369 std::map<QString, QTextCodec*> names;
|
joachim99@70
|
370 QList<int> mibs = QTextCodec::availableMibs();
|
joachim99@70
|
371 foreach(int i, mibs)
|
joachim99@68
|
372 {
|
joachim99@70
|
373 QTextCodec* c = QTextCodec::codecForMib(i);
|
joachim99@68
|
374 if ( c==0 ) break;
|
joachim99@68
|
375 else names[QString(c->name()).upper()]=c;
|
joachim99@68
|
376 }
|
joachim99@68
|
377
|
joachim99@68
|
378 std::map<QString, QTextCodec*>::iterator it;
|
joachim99@68
|
379 for(it=names.begin();it!=names.end();++it)
|
joachim99@68
|
380 {
|
joachim99@68
|
381 insertCodec( "", it->second );
|
joachim99@68
|
382 }
|
joachim99@68
|
383
|
joachim99@68
|
384 QToolTip::add( this, i18n(
|
joachim99@68
|
385 "Change this if non-ASCII characters are not displayed correctly."
|
joachim99@68
|
386 ));
|
joachim99@68
|
387 }
|
joachim99@68
|
388 void insertCodec( const QString& visibleCodecName, QTextCodec* c )
|
joachim99@68
|
389 {
|
joachim99@68
|
390 if (c!=0)
|
joachim99@68
|
391 {
|
joachim99@68
|
392 for( unsigned int i=0; i<m_codecVec.size(); ++i )
|
joachim99@68
|
393 {
|
joachim99@68
|
394 if ( c==m_codecVec[i] )
|
joachim99@68
|
395 return; // don't insert any codec twice
|
joachim99@68
|
396 }
|
joachim99@68
|
397 insertItem( visibleCodecName.isEmpty() ? QString(c->name()) : visibleCodecName+" ("+c->name()+")", m_codecVec.size() );
|
joachim99@68
|
398 m_codecVec.push_back( c );
|
joachim99@68
|
399 }
|
joachim99@68
|
400 }
|
joachim99@68
|
401 void setToDefault()
|
joachim99@69
|
402 {
|
joachim99@69
|
403 QString defaultName = QTextCodec::codecForLocale()->name();
|
joachim99@69
|
404 for(int i=0;i<count();++i)
|
joachim99@69
|
405 {
|
joachim99@69
|
406 if (defaultName==text(i) &&
|
joachim99@69
|
407 m_codecVec[i]==QTextCodec::codecForLocale())
|
joachim99@69
|
408 {
|
joachim99@69
|
409 setCurrentItem(i);
|
joachim99@69
|
410 if (m_ppVarCodec!=0){ *m_ppVarCodec=m_codecVec[i]; }
|
joachim99@69
|
411 return;
|
joachim99@69
|
412 }
|
joachim99@69
|
413 }
|
joachim99@69
|
414
|
joachim99@69
|
415 setCurrentItem( 0 );
|
joachim99@69
|
416 if (m_ppVarCodec!=0){ *m_ppVarCodec=m_codecVec[0]; }
|
joachim99@68
|
417 }
|
joachim99@68
|
418 void setToCurrent()
|
joachim99@68
|
419 {
|
joachim99@68
|
420 if (m_ppVarCodec!=0)
|
joachim99@68
|
421 {
|
joachim99@68
|
422 for(unsigned int i=0; i<m_codecVec.size(); ++i)
|
joachim99@68
|
423 {
|
joachim99@68
|
424 if ( *m_ppVarCodec==m_codecVec[i] )
|
joachim99@68
|
425 {
|
joachim99@68
|
426 setCurrentItem( i );
|
joachim99@68
|
427 break;
|
joachim99@68
|
428 }
|
joachim99@68
|
429 }
|
joachim99@68
|
430 }
|
joachim99@68
|
431 }
|
joachim99@68
|
432 void apply()
|
joachim99@68
|
433 {
|
joachim99@68
|
434 if (m_ppVarCodec!=0){ *m_ppVarCodec = m_codecVec[ currentItem() ]; }
|
joachim99@68
|
435 }
|
joachim99@69
|
436 void write(ValueMap* config)
|
joachim99@68
|
437 {
|
joachim99@70
|
438 if (m_ppVarCodec!=0) config->writeEntry(m_saveName, QString((*m_ppVarCodec)->name()) );
|
joachim99@68
|
439 }
|
joachim99@69
|
440 void read (ValueMap* config)
|
joachim99@68
|
441 {
|
joachim99@68
|
442 QString codecName = config->readEntry( m_saveName, m_codecVec[ currentItem() ]->name() );
|
joachim99@68
|
443 for(unsigned int i=0; i<m_codecVec.size(); ++i)
|
joachim99@68
|
444 {
|
joachim99@68
|
445 if ( codecName == m_codecVec[i]->name() )
|
joachim99@68
|
446 {
|
joachim99@68
|
447 setCurrentItem( i );
|
joachim99@68
|
448 if (m_ppVarCodec!=0) *m_ppVarCodec = m_codecVec[i];
|
joachim99@68
|
449 break;
|
joachim99@68
|
450 }
|
joachim99@68
|
451 }
|
joachim99@68
|
452 }
|
joachim99@68
|
453 };
|
joachim99@68
|
454
|
joachim99@68
|
455
|
joachim99@8
|
456 OptionDialog::OptionDialog( bool bShowDirMergeSettings, QWidget *parent, char *name )
|
joachim99@8
|
457 :KDialogBase( IconList, i18n("Configure"), Help|Default|Apply|Ok|Cancel,
|
joachim99@8
|
458 Ok, parent, name, true /*modal*/, true )
|
joachim99@8
|
459 {
|
joachim99@68
|
460 setHelp( "kdiff3/index.html", QString::null );
|
joachim99@8
|
461
|
joachim99@68
|
462 setupFontPage();
|
joachim99@68
|
463 setupColorPage();
|
joachim99@68
|
464 setupEditPage();
|
joachim99@68
|
465 setupDiffPage();
|
joachim99@68
|
466 setupOtherOptions();
|
joachim99@68
|
467 if (bShowDirMergeSettings)
|
joachim99@68
|
468 setupDirectoryMergePage();
|
joachim99@58
|
469
|
joachim99@68
|
470 setupRegionalPage();
|
joachim99@69
|
471 setupIntegrationPage();
|
joachim99@8
|
472
|
joachim99@68
|
473 //setupKeysPage();
|
joachim99@68
|
474
|
joachim99@68
|
475 // Initialize all values in the dialog
|
joachim99@68
|
476 resetToDefaults();
|
joachim99@68
|
477 slotApply();
|
joachim99@8
|
478 }
|
joachim99@8
|
479
|
joachim99@8
|
480 OptionDialog::~OptionDialog( void )
|
joachim99@8
|
481 {
|
joachim99@8
|
482 }
|
joachim99@8
|
483
|
joachim99@51
|
484 void OptionDialog::setupOtherOptions()
|
joachim99@51
|
485 {
|
joachim99@51
|
486 new OptionToggleAction( false, "AutoAdvance", &m_bAutoAdvance, this );
|
joachim99@51
|
487 new OptionToggleAction( true, "ShowWhiteSpaceCharacters", &m_bShowWhiteSpaceCharacters, this );
|
joachim99@51
|
488 new OptionToggleAction( true, "ShowWhiteSpace", &m_bShowWhiteSpace, this );
|
joachim99@51
|
489 new OptionToggleAction( false, "ShowLineNumbers", &m_bShowLineNumbers, this );
|
joachim99@51
|
490 new OptionToggleAction( true, "HorizDiffWindowSplitting", &m_bHorizDiffWindowSplitting, this );
|
joachim99@66
|
491 new OptionToggleAction( false, "WordWrap", &m_bWordWrap, this );
|
joachim99@69
|
492
|
joachim99@69
|
493 new OptionToggleAction( true, "ShowIdenticalFiles", &m_bDmShowIdenticalFiles, this );
|
joachim99@69
|
494
|
joachim99@69
|
495 new OptionToggleAction( true, "Show Toolbar", &m_bShowToolBar, this );
|
joachim99@69
|
496 new OptionToggleAction( true, "Show Statusbar", &m_bShowStatusBar, this );
|
joachim99@69
|
497
|
joachim99@69
|
498 new OptionNum( (int)KToolBar::Top, "ToolBarPos", &m_toolBarPos, this );
|
joachim99@69
|
499 new OptionSize( QSize(600,400),"Geometry", &m_geometry, this );
|
joachim99@69
|
500 new OptionPoint( QPoint(0,22), "Position", &m_position, this );
|
joachim99@69
|
501
|
joachim99@69
|
502 new OptionStringList( "RecentAFiles", &m_recentAFiles, this );
|
joachim99@69
|
503 new OptionStringList( "RecentBFiles", &m_recentBFiles, this );
|
joachim99@69
|
504 new OptionStringList( "RecentCFiles", &m_recentCFiles, this );
|
joachim99@69
|
505 new OptionStringList( "RecentOutputFiles", &m_recentOutputFiles, this );
|
joachim99@51
|
506 }
|
joachim99@8
|
507
|
joachim99@8
|
508 void OptionDialog::setupFontPage( void )
|
joachim99@8
|
509 {
|
joachim99@73
|
510 QFrame *page = addPage( i18n("Font"), i18n("Editor & Diff Output Font" ),
|
joachim99@8
|
511 BarIcon("fonts", KIcon::SizeMedium ) );
|
joachim99@8
|
512
|
joachim99@70
|
513 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@51
|
514
|
joachim99@69
|
515 QFont defaultFont =
|
joachim99@69
|
516 #ifdef _WIN32
|
joachim99@69
|
517 QFont("Courier New", 10 );
|
joachim99@69
|
518 #elif defined( KREPLACEMENTS_H )
|
joachim99@69
|
519 QFont("Courier", 10 );
|
joachim99@69
|
520 #else
|
joachim99@69
|
521 KGlobalSettings::fixedFont();
|
joachim99@69
|
522 #endif
|
joachim99@69
|
523
|
joachim99@69
|
524 OptionFontChooser* pFontChooser = new OptionFontChooser( defaultFont, "Font", &m_font, page, this );
|
joachim99@69
|
525 topLayout->addWidget( pFontChooser );
|
joachim99@8
|
526
|
joachim99@70
|
527 Q3GridLayout *gbox = new Q3GridLayout( 1, 2 );
|
joachim99@8
|
528 topLayout->addLayout( gbox );
|
joachim99@8
|
529 int line=0;
|
joachim99@8
|
530
|
joachim99@51
|
531 OptionCheckBox* pItalicDeltas = new OptionCheckBox( i18n("Italic font for deltas"), false, "ItalicForDeltas", &m_bItalicForDeltas, page, this );
|
joachim99@8
|
532 gbox->addMultiCellWidget( pItalicDeltas, line, line, 0, 1 );
|
joachim99@8
|
533 QToolTip::add( pItalicDeltas, i18n(
|
joachim99@8
|
534 "Selects the italic version of the font for differences.\n"
|
joachim99@8
|
535 "If the font doesn't support italic characters, then this does nothing.")
|
joachim99@8
|
536 );
|
joachim99@8
|
537 }
|
joachim99@8
|
538
|
joachim99@8
|
539
|
joachim99@8
|
540 void OptionDialog::setupColorPage( void )
|
joachim99@8
|
541 {
|
joachim99@73
|
542 QFrame *page = addPage( i18n("Color"), i18n("Colors Settings"),
|
joachim99@8
|
543 BarIcon("colorize", KIcon::SizeMedium ) );
|
joachim99@70
|
544 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
545
|
joachim99@70
|
546 Q3GridLayout *gbox = new Q3GridLayout( 7, 2 );
|
joachim99@69
|
547 gbox->setColStretch(1,5);
|
joachim99@8
|
548 topLayout->addLayout(gbox);
|
joachim99@8
|
549
|
joachim99@8
|
550 QLabel* label;
|
joachim99@8
|
551 int line = 0;
|
joachim99@8
|
552
|
joachim99@70
|
553 int depth = QPixmap::defaultDepth();
|
joachim99@8
|
554 bool bLowColor = depth<=8;
|
joachim99@8
|
555
|
joachim99@69
|
556 label = new QLabel( i18n("Editor and Diff Views:"), page );
|
joachim99@69
|
557 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
558 QFont f( label->font() );
|
joachim99@69
|
559 f.setBold(true);
|
joachim99@69
|
560 label->setFont(f);
|
joachim99@69
|
561 ++line;
|
joachim99@69
|
562
|
joachim99@69
|
563 OptionColorButton* pFgColor = new OptionColorButton( Qt::black,"FgColor", &m_fgColor, page, this );
|
joachim99@8
|
564 label = new QLabel( pFgColor, i18n("Foreground color:"), page );
|
joachim99@8
|
565 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
566 gbox->addWidget( pFgColor, line, 1 );
|
joachim99@8
|
567 ++line;
|
joachim99@8
|
568
|
joachim99@69
|
569 OptionColorButton* pBgColor = new OptionColorButton( Qt::white, "BgColor", &m_bgColor, page, this );
|
joachim99@8
|
570 label = new QLabel( pBgColor, i18n("Background color:"), page );
|
joachim99@8
|
571 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
572 gbox->addWidget( pBgColor, line, 1 );
|
joachim99@8
|
573
|
joachim99@8
|
574 ++line;
|
joachim99@8
|
575
|
joachim99@69
|
576 OptionColorButton* pDiffBgColor = new OptionColorButton(
|
joachim99@69
|
577 bLowColor ? Qt::lightGray : qRgb(224,224,224), "DiffBgColor", &m_diffBgColor, page, this );
|
joachim99@8
|
578 label = new QLabel( pDiffBgColor, i18n("Diff background color:"), page );
|
joachim99@8
|
579 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
580 gbox->addWidget( pDiffBgColor, line, 1 );
|
joachim99@8
|
581 ++line;
|
joachim99@8
|
582
|
joachim99@8
|
583 OptionColorButton* pColorA = new OptionColorButton(
|
joachim99@8
|
584 bLowColor ? qRgb(0,0,255) : qRgb(0,0,200)/*blue*/, "ColorA", &m_colorA, page, this );
|
joachim99@8
|
585 label = new QLabel( pColorA, i18n("Color A:"), page );
|
joachim99@8
|
586 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
587 gbox->addWidget( pColorA, line, 1 );
|
joachim99@8
|
588 ++line;
|
joachim99@8
|
589
|
joachim99@8
|
590 OptionColorButton* pColorB = new OptionColorButton(
|
joachim99@8
|
591 bLowColor ? qRgb(0,128,0) : qRgb(0,150,0)/*green*/, "ColorB", &m_colorB, page, this );
|
joachim99@8
|
592 label = new QLabel( pColorB, i18n("Color B:"), page );
|
joachim99@8
|
593 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
594 gbox->addWidget( pColorB, line, 1 );
|
joachim99@8
|
595 ++line;
|
joachim99@8
|
596
|
joachim99@8
|
597 OptionColorButton* pColorC = new OptionColorButton(
|
joachim99@8
|
598 bLowColor ? qRgb(128,0,128) : qRgb(150,0,150)/*magenta*/, "ColorC", &m_colorC, page, this );
|
joachim99@8
|
599 label = new QLabel( pColorC, i18n("Color C:"), page );
|
joachim99@8
|
600 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
601 gbox->addWidget( pColorC, line, 1 );
|
joachim99@8
|
602 ++line;
|
joachim99@8
|
603
|
joachim99@69
|
604 OptionColorButton* pColorForConflict = new OptionColorButton( Qt::red, "ColorForConflict", &m_colorForConflict, page, this );
|
joachim99@51
|
605 label = new QLabel( pColorForConflict, i18n("Conflict color:"), page );
|
joachim99@8
|
606 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
607 gbox->addWidget( pColorForConflict, line, 1 );
|
joachim99@8
|
608 ++line;
|
joachim99@8
|
609
|
joachim99@8
|
610 OptionColorButton* pColor = new OptionColorButton(
|
joachim99@8
|
611 bLowColor ? qRgb(192,192,192) : qRgb(220,220,100), "CurrentRangeBgColor", &m_currentRangeBgColor, page, this );
|
joachim99@8
|
612 label = new QLabel( pColor, i18n("Current range background color:"), page );
|
joachim99@8
|
613 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
614 gbox->addWidget( pColor, line, 1 );
|
joachim99@8
|
615 ++line;
|
joachim99@8
|
616
|
joachim99@8
|
617 pColor = new OptionColorButton(
|
joachim99@8
|
618 bLowColor ? qRgb(255,255,0) : qRgb(255,255,150), "CurrentRangeDiffBgColor", &m_currentRangeDiffBgColor, page, this );
|
joachim99@8
|
619 label = new QLabel( pColor, i18n("Current range diff background color:"), page );
|
joachim99@8
|
620 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
621 gbox->addWidget( pColor, line, 1 );
|
joachim99@8
|
622 ++line;
|
joachim99@8
|
623
|
joachim99@69
|
624 pColor = new OptionColorButton( qRgb(0xff,0xd0,0x80), "ManualAlignmentRangeColor", &m_manualHelpRangeColor, page, this );
|
joachim99@69
|
625 label = new QLabel( pColor, i18n("Color for manually aligned difference ranges:"), page );
|
joachim99@69
|
626 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
627 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
628 ++line;
|
joachim99@69
|
629
|
joachim99@69
|
630 label = new QLabel( i18n("Directory Comparison View:"), page );
|
joachim99@69
|
631 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
632 label->setFont(f);
|
joachim99@69
|
633 ++line;
|
joachim99@69
|
634
|
joachim99@69
|
635 pColor = new OptionColorButton( qRgb(0,0xd0,0), "NewestFileColor", &m_newestFileColor, page, this );
|
joachim99@69
|
636 label = new QLabel( pColor, i18n("Newest file color:"), page );
|
joachim99@69
|
637 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
638 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
639 QString dirColorTip = i18n( "Changing this color will only be effective when starting the next directory comparison.");
|
joachim99@69
|
640 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
641 ++line;
|
joachim99@69
|
642
|
joachim99@69
|
643 pColor = new OptionColorButton( qRgb(0xf0,0,0), "OldestFileColor", &m_oldestFileColor, page, this );
|
joachim99@69
|
644 label = new QLabel( pColor, i18n("Oldest file color:"), page );
|
joachim99@69
|
645 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
646 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
647 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
648 ++line;
|
joachim99@69
|
649
|
joachim99@69
|
650 pColor = new OptionColorButton( qRgb(0xc0,0xc0,0), "MidAgeFileColor", &m_midAgeFileColor, page, this );
|
joachim99@69
|
651 label = new QLabel( pColor, i18n("Middle age file color:"), page );
|
joachim99@69
|
652 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
653 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
654 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
655 ++line;
|
joachim99@69
|
656
|
joachim99@69
|
657 pColor = new OptionColorButton( qRgb(0,0,0), "MissingFileColor", &m_missingFileColor, page, this );
|
joachim99@69
|
658 label = new QLabel( pColor, i18n("Color for missing files:"), page );
|
joachim99@69
|
659 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
660 gbox->addWidget( pColor, line, 1 );
|
joachim99@69
|
661 QToolTip::add( label, dirColorTip );
|
joachim99@69
|
662 ++line;
|
joachim99@69
|
663
|
joachim99@8
|
664 topLayout->addStretch(10);
|
joachim99@8
|
665 }
|
joachim99@8
|
666
|
joachim99@8
|
667
|
joachim99@8
|
668 void OptionDialog::setupEditPage( void )
|
joachim99@8
|
669 {
|
joachim99@73
|
670 QFrame *page = addPage( i18n("Editor"), i18n("Editor Behavior"),
|
joachim99@8
|
671 BarIcon("edit", KIcon::SizeMedium ) );
|
joachim99@70
|
672 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
673
|
joachim99@70
|
674 Q3GridLayout *gbox = new Q3GridLayout( 4, 2 );
|
joachim99@69
|
675 gbox->setColStretch(1,5);
|
joachim99@8
|
676 topLayout->addLayout( gbox );
|
joachim99@8
|
677 QLabel* label;
|
joachim99@8
|
678 int line=0;
|
joachim99@8
|
679
|
joachim99@8
|
680 OptionCheckBox* pReplaceTabs = new OptionCheckBox( i18n("Tab inserts spaces"), false, "ReplaceTabs", &m_bReplaceTabs, page, this );
|
joachim99@8
|
681 gbox->addMultiCellWidget( pReplaceTabs, line, line, 0, 1 );
|
joachim99@8
|
682 QToolTip::add( pReplaceTabs, i18n(
|
joachim99@8
|
683 "On: Pressing tab generates the appropriate number of spaces.\n"
|
joachim99@8
|
684 "Off: A Tab-character will be inserted.")
|
joachim99@8
|
685 );
|
joachim99@8
|
686 ++line;
|
joachim99@8
|
687
|
joachim99@8
|
688 OptionIntEdit* pTabSize = new OptionIntEdit( 8, "TabSize", &m_tabSize, 1, 100, page, this );
|
joachim99@8
|
689 label = new QLabel( pTabSize, i18n("Tab size:"), page );
|
joachim99@8
|
690 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
691 gbox->addWidget( pTabSize, line, 1 );
|
joachim99@8
|
692 ++line;
|
joachim99@8
|
693
|
joachim99@51
|
694 OptionCheckBox* pAutoIndentation = new OptionCheckBox( i18n("Auto indentation"), true, "AutoIndentation", &m_bAutoIndentation, page, this );
|
joachim99@8
|
695 gbox->addMultiCellWidget( pAutoIndentation, line, line, 0, 1 );
|
joachim99@8
|
696 QToolTip::add( pAutoIndentation, i18n(
|
joachim99@8
|
697 "On: The indentation of the previous line is used for a new line.\n"
|
joachim99@8
|
698 ));
|
joachim99@8
|
699 ++line;
|
joachim99@8
|
700
|
joachim99@51
|
701 OptionCheckBox* pAutoCopySelection = new OptionCheckBox( i18n("Auto copy selection"), false, "AutoCopySelection", &m_bAutoCopySelection, page, this );
|
joachim99@8
|
702 gbox->addMultiCellWidget( pAutoCopySelection, line, line, 0, 1 );
|
joachim99@8
|
703 QToolTip::add( pAutoCopySelection, i18n(
|
joachim99@8
|
704 "On: Any selection is immediately written to the clipboard.\n"
|
joachim99@8
|
705 "Off: You must explicitely copy e.g. via Ctrl-C."
|
joachim99@8
|
706 ));
|
joachim99@8
|
707 ++line;
|
joachim99@58
|
708
|
joachim99@68
|
709 label = new QLabel( i18n("Line end style:"), page );
|
joachim99@58
|
710 gbox->addWidget( label, line, 0 );
|
joachim99@58
|
711 #ifdef _WIN32
|
joachim99@58
|
712 int defaultLineEndStyle = eLineEndDos;
|
joachim99@58
|
713 #else
|
joachim99@58
|
714 int defaultLineEndStyle = eLineEndUnix;
|
joachim99@58
|
715 #endif
|
joachim99@58
|
716 OptionComboBox* pLineEndStyle = new OptionComboBox( defaultLineEndStyle, "LineEndStyle", &m_lineEndStyle, page, this );
|
joachim99@58
|
717 gbox->addWidget( pLineEndStyle, line, 1 );
|
joachim99@58
|
718 pLineEndStyle->insertItem( "Unix", eLineEndUnix );
|
joachim99@58
|
719 pLineEndStyle->insertItem( "Dos/Windows", eLineEndDos );
|
joachim99@58
|
720 QToolTip::add( label, i18n(
|
joachim99@68
|
721 "Sets the line endings for when an edited file is saved.\n"
|
joachim99@68
|
722 "DOS/Windows: CR+LF; UNIX: LF; with CR=0D, LF=0A")
|
joachim99@58
|
723 );
|
joachim99@58
|
724 ++line;
|
joachim99@58
|
725
|
joachim99@8
|
726 topLayout->addStretch(10);
|
joachim99@8
|
727 }
|
joachim99@8
|
728
|
joachim99@8
|
729
|
joachim99@8
|
730 void OptionDialog::setupDiffPage( void )
|
joachim99@8
|
731 {
|
joachim99@73
|
732 QFrame *page = addPage( i18n("Diff and Merge"), i18n("Diff and Merge Settings"),
|
joachim99@8
|
733 BarIcon("misc", KIcon::SizeMedium ) );
|
joachim99@70
|
734 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
735
|
joachim99@70
|
736 Q3GridLayout *gbox = new Q3GridLayout( 3, 2 );
|
joachim99@69
|
737 gbox->setColStretch(1,5);
|
joachim99@8
|
738 topLayout->addLayout( gbox );
|
joachim99@8
|
739 int line=0;
|
joachim99@8
|
740
|
joachim99@51
|
741 QLabel* label=0;
|
joachim99@51
|
742
|
joachim99@51
|
743 OptionCheckBox* pPreserveCarriageReturn = new OptionCheckBox( i18n("Preserve carriage return"), false, "PreserveCarriageReturn", &m_bPreserveCarriageReturn, page, this );
|
joachim99@51
|
744 gbox->addMultiCellWidget( pPreserveCarriageReturn, line, line, 0, 1 );
|
joachim99@51
|
745 QToolTip::add( pPreserveCarriageReturn, i18n(
|
joachim99@51
|
746 "Show carriage return characters '\\r' if they exist.\n"
|
joachim99@51
|
747 "Helps to compare files that were modified under different operating systems.")
|
joachim99@8
|
748 );
|
joachim99@8
|
749 ++line;
|
joachim99@8
|
750
|
joachim99@51
|
751 OptionCheckBox* pIgnoreNumbers = new OptionCheckBox( i18n("Ignore numbers"), false, "IgnoreNumbers", &m_bIgnoreNumbers, page, this );
|
joachim99@51
|
752 gbox->addMultiCellWidget( pIgnoreNumbers, line, line, 0, 1 );
|
joachim99@51
|
753 QToolTip::add( pIgnoreNumbers, i18n(
|
joachim99@51
|
754 "Ignore number characters during line matching phase. (Similar to Ignore white space.)\n"
|
joachim99@51
|
755 "Might help to compare files with numeric data.")
|
joachim99@8
|
756 );
|
joachim99@8
|
757 ++line;
|
joachim99@8
|
758
|
joachim99@68
|
759 OptionCheckBox* pIgnoreComments = new OptionCheckBox( i18n("Ignore C/C++ comments"), false, "IgnoreComments", &m_bIgnoreComments, page, this );
|
joachim99@51
|
760 gbox->addMultiCellWidget( pIgnoreComments, line, line, 0, 1 );
|
joachim99@51
|
761 QToolTip::add( pIgnoreComments, i18n( "Treat C/C++ comments like white space.")
|
joachim99@8
|
762 );
|
joachim99@8
|
763 ++line;
|
joachim99@8
|
764
|
joachim99@66
|
765 OptionCheckBox* pIgnoreCase = new OptionCheckBox( i18n("Ignore case"), false, "IgnoreCase", &m_bIgnoreCase, page, this );
|
joachim99@66
|
766 gbox->addMultiCellWidget( pIgnoreCase, line, line, 0, 1 );
|
joachim99@66
|
767 QToolTip::add( pIgnoreCase, i18n(
|
joachim99@66
|
768 "Treat case differences like white space changes. ('a'<=>'A')")
|
joachim99@8
|
769 );
|
joachim99@8
|
770 ++line;
|
joachim99@8
|
771
|
joachim99@51
|
772 label = new QLabel( i18n("Preprocessor command:"), page );
|
joachim99@8
|
773 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
774 OptionLineEdit* pLE = new OptionLineEdit( "", "PreProcessorCmd", &m_PreProcessorCmd, page, this );
|
joachim99@8
|
775 gbox->addWidget( pLE, line, 1 );
|
joachim99@8
|
776 QToolTip::add( label, i18n("User defined pre-processing. (See the docs for details.)") );
|
joachim99@8
|
777 ++line;
|
joachim99@8
|
778
|
joachim99@51
|
779 label = new QLabel( i18n("Line-matching preprocessor command:"), page );
|
joachim99@8
|
780 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
781 pLE = new OptionLineEdit( "", "LineMatchingPreProcessorCmd", &m_LineMatchingPreProcessorCmd, page, this );
|
joachim99@8
|
782 gbox->addWidget( pLE, line, 1 );
|
joachim99@8
|
783 QToolTip::add( label, i18n("This pre-processor is only used during line matching.\n(See the docs for details.)") );
|
joachim99@8
|
784 ++line;
|
joachim99@8
|
785
|
joachim99@51
|
786 OptionCheckBox* pTryHard = new OptionCheckBox( i18n("Try hard (slower)"), true, "TryHard", &m_bTryHard, page, this );
|
joachim99@51
|
787 gbox->addMultiCellWidget( pTryHard, line, line, 0, 1 );
|
joachim99@51
|
788 QToolTip::add( pTryHard, i18n(
|
joachim99@51
|
789 "Enables the --minimal option for the external diff.\n"
|
joachim99@51
|
790 "The analysis of big files will be much slower.")
|
joachim99@8
|
791 );
|
joachim99@8
|
792 ++line;
|
joachim99@8
|
793
|
joachim99@51
|
794 label = new QLabel( i18n("Auto advance delay (ms):"), page );
|
joachim99@8
|
795 gbox->addWidget( label, line, 0 );
|
joachim99@8
|
796 OptionIntEdit* pAutoAdvanceDelay = new OptionIntEdit( 500, "AutoAdvanceDelay", &m_autoAdvanceDelay, 0, 2000, page, this );
|
joachim99@8
|
797 gbox->addWidget( pAutoAdvanceDelay, line, 1 );
|
joachim99@8
|
798 QToolTip::add( label,i18n(
|
joachim99@8
|
799 "When in Auto-Advance mode the result of the current selection is shown \n"
|
joachim99@8
|
800 "for the specified time, before jumping to the next conflict. Range: 0-2000 ms")
|
joachim99@8
|
801 );
|
joachim99@8
|
802 ++line;
|
joachim99@8
|
803
|
joachim99@51
|
804 label = new QLabel( i18n("White space 2-file merge default:"), page );
|
joachim99@51
|
805 gbox->addWidget( label, line, 0 );
|
joachim99@51
|
806 OptionComboBox* pWhiteSpace2FileMergeDefault = new OptionComboBox( 0, "WhiteSpace2FileMergeDefault", &m_whiteSpace2FileMergeDefault, page, this );
|
joachim99@51
|
807 gbox->addWidget( pWhiteSpace2FileMergeDefault, line, 1 );
|
joachim99@68
|
808 pWhiteSpace2FileMergeDefault->insertItem( i18n("Manual Choice"), 0 );
|
joachim99@51
|
809 pWhiteSpace2FileMergeDefault->insertItem( "A", 1 );
|
joachim99@51
|
810 pWhiteSpace2FileMergeDefault->insertItem( "B", 2 );
|
joachim99@58
|
811 QToolTip::add( label, i18n(
|
joachim99@51
|
812 "Allow the merge algorithm to automatically select an input for "
|
joachim99@51
|
813 "white-space-only changes." )
|
joachim99@51
|
814 );
|
joachim99@51
|
815 ++line;
|
joachim99@51
|
816
|
joachim99@51
|
817 label = new QLabel( i18n("White space 3-file merge default:"), page );
|
joachim99@51
|
818 gbox->addWidget( label, line, 0 );
|
joachim99@51
|
819 OptionComboBox* pWhiteSpace3FileMergeDefault = new OptionComboBox( 0, "WhiteSpace3FileMergeDefault", &m_whiteSpace3FileMergeDefault, page, this );
|
joachim99@51
|
820 gbox->addWidget( pWhiteSpace3FileMergeDefault, line, 1 );
|
joachim99@68
|
821 pWhiteSpace3FileMergeDefault->insertItem( i18n("Manual Choice"), 0 );
|
joachim99@51
|
822 pWhiteSpace3FileMergeDefault->insertItem( "A", 1 );
|
joachim99@51
|
823 pWhiteSpace3FileMergeDefault->insertItem( "B", 2 );
|
joachim99@51
|
824 pWhiteSpace3FileMergeDefault->insertItem( "C", 3 );
|
joachim99@58
|
825 QToolTip::add( label, i18n(
|
joachim99@51
|
826 "Allow the merge algorithm to automatically select an input for "
|
joachim99@51
|
827 "white-space-only changes." )
|
joachim99@51
|
828 );
|
joachim99@51
|
829 ++line;
|
joachim99@51
|
830
|
joachim99@70
|
831 Q3GroupBox* pGroupBox = new Q3GroupBox( 2, Qt::Horizontal, i18n("Automatic Merge Regular Expression"), page);
|
joachim99@69
|
832 gbox->addMultiCellWidget( pGroupBox, line,line,0,1);
|
joachim99@69
|
833 ++line;
|
joachim99@69
|
834 {
|
joachim99@69
|
835 QWidget* page = new QWidget( pGroupBox );
|
joachim99@70
|
836 Q3GridLayout* gbox = new Q3GridLayout( page, 2, 2, spacingHint() );
|
joachim99@69
|
837 gbox->setColStretch(1,10);
|
joachim99@69
|
838 int line = 0;
|
joachim99@69
|
839
|
joachim99@69
|
840 label = new QLabel( i18n("Auto merge regular expression:"), page );
|
joachim99@69
|
841 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
842 m_pAutoMergeRegExpLineEdit = new OptionLineEdit( ".*\\$(Version|Header|Date|Author).*\\$.*", "AutoMergeRegExp", &m_autoMergeRegExp, page, this );
|
joachim99@69
|
843 gbox->addWidget( m_pAutoMergeRegExpLineEdit, line, 1 );
|
joachim99@69
|
844 s_autoMergeRegExpToolTip = i18n("Regular expression for lines where KDiff3 should automatically choose one source.\n"
|
joachim99@69
|
845 "When a line with a conflict matches the regular expression then\n"
|
joachim99@69
|
846 "- if available - C, otherwise B will be chosen.");
|
joachim99@69
|
847 QToolTip::add( label, s_autoMergeRegExpToolTip );
|
joachim99@69
|
848 ++line;
|
joachim99@69
|
849
|
joachim99@69
|
850 OptionCheckBox* pAutoMergeRegExp = new OptionCheckBox( i18n("Run regular expression auto merge on merge start"), false, "RunRegExpAutoMergeOnMergeStart", &m_bRunRegExpAutoMergeOnMergeStart, page, this );
|
joachim99@69
|
851 gbox->addMultiCellWidget( pAutoMergeRegExp, line, line, 0, 1 );
|
joachim99@69
|
852 QToolTip::add( pAutoMergeRegExp, i18n( "Run the merge for auto merge regular expressions\n"
|
joachim99@69
|
853 "immediately when a merge starts.\n"));
|
joachim99@69
|
854 ++line;
|
joachim99@69
|
855 }
|
joachim99@69
|
856
|
joachim99@70
|
857 pGroupBox = new Q3GroupBox( 2, Qt::Horizontal, i18n("Version Control History Merging"), page);
|
joachim99@69
|
858 gbox->addMultiCellWidget( pGroupBox, line,line,0,1);
|
joachim99@69
|
859 ++line;
|
joachim99@69
|
860 {
|
joachim99@69
|
861 QWidget* page = new QWidget( pGroupBox );
|
joachim99@70
|
862 Q3GridLayout* gbox = new Q3GridLayout( page, 2, 2, spacingHint() );
|
joachim99@69
|
863 gbox->setColStretch(1,10);
|
joachim99@69
|
864 int line = 0;
|
joachim99@69
|
865
|
joachim99@69
|
866 label = new QLabel( i18n("History start regular expression:"), page );
|
joachim99@69
|
867 gbox->addWidget( label, line, 0 );
|
joachim99@69
|
868 m_pHistoryStartRegExpLineEdit = new OptionLineEdit( ".*\\$Log.*\\$.*", "HistoryStartRegExp", &m_historyStartRegExp, page, this );
|
joachim99@69
|
869 gbox->addWidget( m_pHistoryStartRegExpLineEdit, line, 1 );
|
joachim99@69
|
870 s_historyStartRegExpToolTip = i18n("Regular expression for the start of the version control history entry.\n"
|
joachim99@70
|
871 "Usually this line contains the \"$Log$\"-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@73
|
948 QFrame *page = addPage( i18n("Directory Merge"), i18n("Directory Merge"),
|
joachim99@8
|
949 BarIcon("folder", KIcon::SizeMedium ) );
|
joachim99@70
|
950 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@8
|
951
|
joachim99@70
|
952 Q3GridLayout *gbox = new Q3GridLayout( 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@70
|
1045 Q3VButtonGroup* pBG = new Q3VButtonGroup(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@73
|
1121 QFrame *page = addPage( i18n("Regional Settings"), i18n("Regional Settings"),
|
joachim99@68
|
1122 BarIcon("locale"/*"charset"*/, KIcon::SizeMedium ) );
|
joachim99@70
|
1123 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@68
|
1124
|
joachim99@70
|
1125 Q3GridLayout *gbox = new Q3GridLayout( 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@73
|
1321 QFrame *page = addPage( i18n("Integration"), i18n("Integration Settings"),
|
joachim99@69
|
1322 BarIcon("launch"/*"charset"*/, KIcon::SizeMedium ) );
|
joachim99@70
|
1323 Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, 5, spacingHint() );
|
joachim99@69
|
1324
|
joachim99@70
|
1325 Q3GridLayout *gbox = new Q3GridLayout( 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@70
|
1575 //#include "optiondialog.moc"
|