|
a/src/qtgui/confgui/confguiindex.cpp |
|
b/src/qtgui/confgui/confguiindex.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.13 2008-09-30 12:38:29 dockes Exp $ (C) 2007 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: confguiindex.cpp,v 1.13 2008-09-30 12:38:29 dockes Exp $ (C) 2007 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
|
4 |
|
5 |
#include <qglobal.h>
|
5 |
#include <qglobal.h>
|
6 |
#if QT_VERSION < 0x040000
|
|
|
7 |
#define QFRAME_INCLUDE <qframe.h>
|
|
|
8 |
#define QFILEDIALOG_INCLUDE <qfiledialog.h>
|
|
|
9 |
#define QLISTBOX_INCLUDE <qlistbox.h>
|
|
|
10 |
#define QFILEDIALOG QFileDialog
|
|
|
11 |
#define QFRAME QFrame
|
|
|
12 |
#define QHBOXLAYOUT QHBoxLayout
|
|
|
13 |
#define QLISTBOX QListBox
|
|
|
14 |
#define QLISTBOXITEM QListBoxItem
|
|
|
15 |
#define QLBEXACTMATCH Qt::ExactMatch
|
|
|
16 |
#define QVBOXLAYOUT QVBoxLayout
|
|
|
17 |
#define QGROUPBOX QGroupBox
|
|
|
18 |
#include <qgroupbox.h>
|
|
|
19 |
#else
|
|
|
20 |
#include <Q3HBoxLayout>
|
6 |
#include <QHBoxLayout>
|
21 |
#include <Q3VBoxLayout>
|
7 |
#include <QVBoxLayout>
|
22 |
#include <Q3GroupBox>
|
8 |
#include <QGroupBox>
|
23 |
|
|
|
24 |
#include <QFrame>
|
9 |
#include <QFrame>
|
25 |
#define QFRAME_INCLUDE <q3frame.h>
|
|
|
26 |
|
|
|
27 |
#include <QFileDialog>
|
10 |
#include <QFileDialog>
|
28 |
#define QFILEDIALOG_INCLUDE <q3filedialog.h>
|
|
|
29 |
|
|
|
30 |
#define QLISTBOX_INCLUDE <q3listbox.h>
|
|
|
31 |
|
|
|
32 |
#define QFILEDIALOG Q3FileDialog
|
|
|
33 |
#define QFRAME Q3Frame
|
|
|
34 |
#define QHBOXLAYOUT Q3HBoxLayout
|
|
|
35 |
#define QLISTBOX Q3ListBox
|
|
|
36 |
#define QLISTBOXITEM Q3ListBoxItem
|
|
|
37 |
#define QLBEXACTMATCH Q3ListBox::ExactMatch
|
|
|
38 |
#define QVBOXLAYOUT Q3VBoxLayout
|
|
|
39 |
#define QGROUPBOX Q3GroupBox
|
|
|
40 |
#endif
|
|
|
41 |
#include <qlayout.h>
|
11 |
#include <qlayout.h>
|
42 |
#include QFRAME_INCLUDE
|
|
|
43 |
#include <qwidget.h>
|
12 |
#include <qwidget.h>
|
44 |
#include <qlabel.h>
|
13 |
#include <qlabel.h>
|
45 |
#include QLISTBOX_INCLUDE
|
|
|
46 |
#include <qtimer.h>
|
14 |
#include <qtimer.h>
|
47 |
#include <qmessagebox.h>
|
15 |
#include <qmessagebox.h>
|
48 |
#include <qcheckbox.h>
|
16 |
#include <qcheckbox.h>
|
|
|
17 |
#include <QListWidget>
|
49 |
|
18 |
|
50 |
#include <list>
|
19 |
#include <list>
|
51 |
using std::list;
|
20 |
using std::list;
|
52 |
|
21 |
|
53 |
#include "confgui.h"
|
22 |
#include "confgui.h"
|
|
... |
|
... |
60 |
#include "conflinkrcl.h"
|
29 |
#include "conflinkrcl.h"
|
61 |
#include "execmd.h"
|
30 |
#include "execmd.h"
|
62 |
#include "rclconfig.h"
|
31 |
#include "rclconfig.h"
|
63 |
|
32 |
|
64 |
namespace confgui {
|
33 |
namespace confgui {
|
65 |
const static int spacing = 6;
|
34 |
const static int spacing = 3;
|
66 |
const static int margin = 6;
|
35 |
const static int margin = 3;
|
67 |
|
36 |
|
68 |
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
37 |
ConfIndexW::ConfIndexW(QWidget *parent, RclConfig *config)
|
69 |
: QTABDIALOG(parent), m_rclconf(config)
|
38 |
: QDialog(parent), m_rclconf(config)
|
70 |
{
|
39 |
{
|
71 |
setCaption(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
40 |
setWindowTitle(QString::fromLocal8Bit(config->getConfDir().c_str()));
|
72 |
setOkButton();
|
41 |
tabWidget = new QTabWidget;
|
73 |
setCancelButton();
|
|
|
74 |
|
|
|
75 |
reloadPanels();
|
42 |
reloadPanels();
|
|
|
43 |
|
|
|
44 |
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
|
|
|
45 |
| QDialogButtonBox::Cancel);
|
|
|
46 |
|
|
|
47 |
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
|
48 |
mainLayout->addWidget(tabWidget);
|
|
|
49 |
mainLayout->addWidget(buttonBox);
|
|
|
50 |
setLayout(mainLayout);
|
|
|
51 |
|
76 |
resize(QSize(600, 500).expandedTo(minimumSizeHint()));
|
52 |
resize(QSize(600, 450).expandedTo(minimumSizeHint()));
|
|
|
53 |
|
77 |
connect(this, SIGNAL(applyButtonPressed()), this, SLOT(acceptChanges()));
|
54 |
connect(buttonBox, SIGNAL(accepted()), this, SLOT(acceptChanges()));
|
78 |
connect(this, SIGNAL(cancelButtonPressed()), this, SLOT(rejectChanges()));
|
55 |
connect(buttonBox, SIGNAL(rejected()), this, SLOT(rejectChanges()));
|
79 |
}
|
56 |
}
|
80 |
|
57 |
|
81 |
void ConfIndexW::acceptChanges()
|
58 |
void ConfIndexW::acceptChanges()
|
82 |
{
|
59 |
{
|
83 |
LOGDEB(("ConfIndexW::acceptChanges()\n"));
|
60 |
LOGDEB(("ConfIndexW::acceptChanges()\n"));
|
|
... |
|
... |
99 |
QTimer::singleShot(0, this, SLOT(reloadPanels()));
|
76 |
QTimer::singleShot(0, this, SLOT(reloadPanels()));
|
100 |
if (startIndexingAfterConfig) {
|
77 |
if (startIndexingAfterConfig) {
|
101 |
startIndexingAfterConfig = 0;
|
78 |
startIndexingAfterConfig = 0;
|
102 |
start_indexing(true);
|
79 |
start_indexing(true);
|
103 |
}
|
80 |
}
|
|
|
81 |
hide();
|
104 |
}
|
82 |
}
|
105 |
|
83 |
|
106 |
void ConfIndexW::rejectChanges()
|
84 |
void ConfIndexW::rejectChanges()
|
107 |
{
|
85 |
{
|
108 |
LOGDEB(("ConfIndexW::rejectChanges()\n"));
|
86 |
LOGDEB(("ConfIndexW::rejectChanges()\n"));
|
109 |
// Discard local changes, and make new copy
|
87 |
// Discard local changes, and make new copy
|
110 |
delete m_conf;
|
88 |
delete m_conf;
|
111 |
m_conf = 0;
|
89 |
m_conf = 0;
|
112 |
QTimer::singleShot(0, this, SLOT(reloadPanels()));
|
90 |
QTimer::singleShot(0, this, SLOT(reloadPanels()));
|
|
|
91 |
hide();
|
113 |
}
|
92 |
}
|
114 |
|
93 |
|
115 |
void ConfIndexW::reloadPanels()
|
94 |
void ConfIndexW::reloadPanels()
|
116 |
{
|
95 |
{
|
117 |
if ((m_conf = m_rclconf->cloneMainConfig()) == 0)
|
96 |
if ((m_conf = m_rclconf->cloneMainConfig()) == 0)
|
118 |
return;
|
97 |
return;
|
119 |
m_conf->holdWrites(true);
|
98 |
m_conf->holdWrites(true);
|
120 |
for (list<QWidget *>::iterator it = m_widgets.begin();
|
99 |
tabWidget->clear();
|
121 |
it != m_widgets.end(); it++) {
|
|
|
122 |
removePage(*it);
|
|
|
123 |
delete *it;
|
|
|
124 |
}
|
|
|
125 |
m_widgets.clear();
|
100 |
m_widgets.clear();
|
126 |
|
101 |
|
127 |
QWidget *w = new ConfTopPanelW(this, m_conf);
|
102 |
QWidget *w = new ConfTopPanelW(this, m_conf);
|
128 |
m_widgets.push_back(w);
|
103 |
m_widgets.push_back(w);
|
129 |
addTab(w, QObject::tr("Global parameters"));
|
104 |
tabWidget->addTab(w, QObject::tr("Global parameters"));
|
130 |
|
105 |
|
131 |
w = new ConfSubPanelW(this, m_conf);
|
106 |
w = new ConfSubPanelW(this, m_conf);
|
132 |
m_widgets.push_back(w);
|
107 |
m_widgets.push_back(w);
|
133 |
addTab(w, QObject::tr("Local parameters"));
|
108 |
tabWidget->addTab(w, QObject::tr("Local parameters"));
|
134 |
|
109 |
|
135 |
w = new ConfBeaglePanelW(this, m_conf);
|
110 |
w = new ConfBeaglePanelW(this, m_conf);
|
136 |
m_widgets.push_back(w);
|
111 |
m_widgets.push_back(w);
|
137 |
addTab(w, QObject::tr("Beagle web history"));
|
112 |
tabWidget->addTab(w, QObject::tr("Beagle web history"));
|
138 |
|
|
|
139 |
}
|
113 |
}
|
140 |
|
114 |
|
141 |
ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
115 |
ConfBeaglePanelW::ConfBeaglePanelW(QWidget *parent, ConfNull *config)
|
142 |
: QWidget(parent)
|
116 |
: QWidget(parent)
|
143 |
{
|
117 |
{
|
144 |
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
118 |
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
145 |
vboxLayout->setSpacing(spacing);
|
119 |
vboxLayout->setSpacing(spacing);
|
146 |
vboxLayout->setMargin(margin);
|
120 |
vboxLayout->setMargin(margin);
|
147 |
|
121 |
|
148 |
ConfLink lnk1(new ConfLinkRclRep(config, "processbeaglequeue"));
|
122 |
ConfLink lnk1(new ConfLinkRclRep(config, "processbeaglequeue"));
|
149 |
ConfParamBoolW* cp1 =
|
123 |
ConfParamBoolW* cp1 =
|
|
... |
|
... |
159 |
new ConfParamFNW(this, lnk2, tr("Web cache directory name"),
|
133 |
new ConfParamFNW(this, lnk2, tr("Web cache directory name"),
|
160 |
tr("The name for a directory where to store the cache "
|
134 |
tr("The name for a directory where to store the cache "
|
161 |
"for visited web pages.<br>"
|
135 |
"for visited web pages.<br>"
|
162 |
"A non-absolute path is taken relative to the "
|
136 |
"A non-absolute path is taken relative to the "
|
163 |
"configuration directory."), true);
|
137 |
"configuration directory."), true);
|
164 |
cp2->setEnabled(cp1->m_cb->isOn());
|
138 |
cp2->setEnabled(cp1->m_cb->isChecked());
|
165 |
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp2, SLOT(setEnabled(bool)));
|
139 |
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp2, SLOT(setEnabled(bool)));
|
166 |
vboxLayout->addWidget(cp2);
|
140 |
vboxLayout->addWidget(cp2);
|
167 |
|
141 |
|
168 |
ConfLink lnk3(new ConfLinkRclRep(config, "webcachemaxmbs"));
|
142 |
ConfLink lnk3(new ConfLinkRclRep(config, "webcachemaxmbs"));
|
169 |
ConfParamIntW *cp3 =
|
143 |
ConfParamIntW *cp3 =
|
170 |
new ConfParamIntW(this, lnk3, tr("Max. size for the web cache (MB)"),
|
144 |
new ConfParamIntW(this, lnk3, tr("Max. size for the web cache (MB)"),
|
171 |
tr("Entries will be recycled once the size is reached"),
|
145 |
tr("Entries will be recycled once the size is reached"),
|
172 |
-1, 1000);
|
146 |
-1, 1000);
|
173 |
cp3->setEnabled(cp1->m_cb->isOn());
|
147 |
cp3->setEnabled(cp1->m_cb->isChecked());
|
174 |
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp3, SLOT(setEnabled(bool)));
|
148 |
connect(cp1->m_cb, SIGNAL(toggled(bool)), cp3, SLOT(setEnabled(bool)));
|
175 |
vboxLayout->addWidget(cp3);
|
149 |
vboxLayout->addWidget(cp3);
|
176 |
vboxLayout->insertStretch(-1);
|
150 |
vboxLayout->insertStretch(-1);
|
177 |
}
|
151 |
}
|
178 |
|
152 |
|
|
... |
|
... |
186 |
ConfLink lnktopdirs(new ConfLinkRclRep(config, "topdirs"));
|
160 |
ConfLink lnktopdirs(new ConfLinkRclRep(config, "topdirs"));
|
187 |
ConfParamDNLW *etopdirs = new
|
161 |
ConfParamDNLW *etopdirs = new
|
188 |
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
|
162 |
ConfParamDNLW(this, lnktopdirs, tr("Top directories"),
|
189 |
tr("The list of directories where recursive "
|
163 |
tr("The list of directories where recursive "
|
190 |
"indexing starts. Default: your home."));
|
164 |
"indexing starts. Default: your home."));
|
191 |
#if QT_VERSION < 0x040000
|
165 |
setSzPol(etopdirs, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
192 |
gl1->addMultiCellWidget(etopdirs, 0, 0, 0, 1);
|
|
|
193 |
#else
|
|
|
194 |
gl1->addWidget(etopdirs, 0, 0, 1, 2);
|
166 |
gl1->addWidget(etopdirs, 0, 0, 1, 2);
|
195 |
#endif
|
|
|
196 |
|
167 |
|
197 |
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
|
168 |
ConfLink lnkskp(new ConfLinkRclRep(config, "skippedPaths"));
|
198 |
ConfParamSLW *eskp = new
|
169 |
ConfParamSLW *eskp = new
|
199 |
ConfParamSLW(this, lnkskp, tr("Skipped paths"),
|
170 |
ConfParamSLW(this, lnkskp, tr("Skipped paths"),
|
200 |
tr("These are names of directories which indexing "
|
171 |
tr("These are names of directories which indexing "
|
|
... |
|
... |
203 |
"the paths seen by the indexer (ie: if topdirs "
|
174 |
"the paths seen by the indexer (ie: if topdirs "
|
204 |
"includes '/home/me' and '/home' is actually a link "
|
175 |
"includes '/home/me' and '/home' is actually a link "
|
205 |
"to '/usr/home', a correct skippedPath entry "
|
176 |
"to '/usr/home', a correct skippedPath entry "
|
206 |
"would be '/home/me/tmp*', not '/usr/home/me/tmp*')"));
|
177 |
"would be '/home/me/tmp*', not '/usr/home/me/tmp*')"));
|
207 |
eskp->setFsEncoding(true);
|
178 |
eskp->setFsEncoding(true);
|
208 |
#if QT_VERSION < 0x040000
|
179 |
setSzPol(eskp, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
209 |
gl1->addMultiCellWidget(eskp, 1, 1, 0, 1);
|
|
|
210 |
#else
|
|
|
211 |
gl1->addWidget(eskp, 1, 0, 1, 2);
|
180 |
gl1->addWidget(eskp, 1, 0, 1, 2);
|
212 |
#endif
|
|
|
213 |
|
181 |
|
214 |
list<string> cstemlangs = Rcl::Db::getStemmerNames();
|
182 |
list<string> cstemlangs = Rcl::Db::getStemmerNames();
|
215 |
QStringList stemlangs;
|
183 |
QStringList stemlangs;
|
216 |
for (list<string>::const_iterator it = cstemlangs.begin();
|
184 |
for (list<string>::const_iterator it = cstemlangs.begin();
|
217 |
it != cstemlangs.end(); it++) {
|
185 |
it != cstemlangs.end(); it++) {
|
|
... |
|
... |
220 |
ConfLink lnkidxsl(new ConfLinkRclRep(config, "indexstemminglanguages"));
|
188 |
ConfLink lnkidxsl(new ConfLinkRclRep(config, "indexstemminglanguages"));
|
221 |
ConfParamCSLW *eidxsl = new
|
189 |
ConfParamCSLW *eidxsl = new
|
222 |
ConfParamCSLW(this, lnkidxsl, tr("Stemming languages"),
|
190 |
ConfParamCSLW(this, lnkidxsl, tr("Stemming languages"),
|
223 |
tr("The languages for which stemming expansion<br>"
|
191 |
tr("The languages for which stemming expansion<br>"
|
224 |
"dictionaries will be built."), stemlangs);
|
192 |
"dictionaries will be built."), stemlangs);
|
225 |
#if QT_VERSION < 0x040000
|
193 |
setSzPol(eidxsl, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 1);
|
226 |
gl1->addMultiCellWidget(eidxsl, 2, 2, 0, 1);
|
|
|
227 |
#else
|
|
|
228 |
gl1->addWidget(eidxsl, 2, 0, 1, 2);
|
194 |
gl1->addWidget(eidxsl, 2, 0, 1, 2);
|
229 |
#endif
|
|
|
230 |
|
195 |
|
231 |
ConfLink lnk4(new ConfLinkRclRep(config, "logfilename"));
|
196 |
ConfLink lnk4(new ConfLinkRclRep(config, "logfilename"));
|
232 |
ConfParamFNW *e4 = new
|
197 |
ConfParamFNW *e4 = new
|
233 |
ConfParamFNW(this, lnk4, tr("Log file name"),
|
198 |
ConfParamFNW(this, lnk4, tr("Log file name"),
|
234 |
tr("The file where the messages will be written.<br>"
|
199 |
tr("The file where the messages will be written.<br>"
|
235 |
"Use 'stderr' for terminal output"), false);
|
200 |
"Use 'stderr' for terminal output"), false);
|
236 |
#if QT_VERSION < 0x040000
|
|
|
237 |
gl1->addMultiCellWidget(e4, 3, 3, 0, 1);
|
|
|
238 |
#else
|
|
|
239 |
gl1->addWidget(e4, 3, 0, 1, 2);
|
201 |
gl1->addWidget(e4, 3, 0, 1, 2);
|
240 |
#endif
|
|
|
241 |
|
202 |
|
242 |
QWidget *w = 0;
|
203 |
QWidget *w = 0;
|
243 |
|
204 |
|
244 |
ConfLink lnk1(new ConfLinkRclRep(config, "loglevel"));
|
205 |
ConfLink lnk1(new ConfLinkRclRep(config, "loglevel"));
|
245 |
w = new ConfParamIntW(this, lnk1, tr("Log verbosity level"),
|
206 |
w = new ConfParamIntW(this, lnk1, tr("Log verbosity level"),
|
|
... |
|
... |
287 |
"If this value is not set, the NLS environment "
|
248 |
"If this value is not set, the NLS environment "
|
288 |
"will be used to compute it, which usually works."
|
249 |
"will be used to compute it, which usually works."
|
289 |
"To get an idea of what is installed on your system, "
|
250 |
"To get an idea of what is installed on your system, "
|
290 |
"type 'aspell config' and look for .dat files inside "
|
251 |
"type 'aspell config' and look for .dat files inside "
|
291 |
"the 'data-dir' directory. "));
|
252 |
"the 'data-dir' directory. "));
|
292 |
cpaspl->setEnabled(!cpasp->m_cb->isOn());
|
253 |
cpaspl->setEnabled(!cpasp->m_cb->isChecked());
|
293 |
connect(cpasp->m_cb, SIGNAL(toggled(bool)), cpaspl,SLOT(setDisabled(bool)));
|
254 |
connect(cpasp->m_cb, SIGNAL(toggled(bool)), cpaspl,SLOT(setDisabled(bool)));
|
294 |
gl1->addWidget(cpaspl, 6, 1);
|
255 |
gl1->addWidget(cpaspl, 6, 1);
|
295 |
|
256 |
|
296 |
ConfLink lnkdbd(new ConfLinkRclRep(config, "dbdir"));
|
257 |
ConfLink lnkdbd(new ConfLinkRclRep(config, "dbdir"));
|
297 |
ConfParamFNW *edbd = new
|
258 |
ConfParamFNW *edbd = new
|
298 |
ConfParamFNW(this, lnkdbd, tr("Database directory name"),
|
259 |
ConfParamFNW(this, lnkdbd, tr("Database directory name"),
|
299 |
tr("The name for a directory where to store the index<br>"
|
260 |
tr("The name for a directory where to store the index<br>"
|
300 |
"A non-absolute path is taken relative to the "
|
261 |
"A non-absolute path is taken relative to the "
|
301 |
" configuration directory. The default is 'xapiandb'."
|
262 |
" configuration directory. The default is 'xapiandb'."
|
302 |
), true);
|
263 |
), true);
|
303 |
#if QT_VERSION < 0x040000
|
|
|
304 |
gl1->addMultiCellWidget(edbd, 7, 7, 0, 1);
|
|
|
305 |
#else
|
|
|
306 |
gl1->addWidget(edbd, 7, 0, 1, 2);
|
264 |
gl1->addWidget(edbd, 7, 0, 1, 2);
|
307 |
#endif
|
|
|
308 |
}
|
265 |
}
|
309 |
|
266 |
|
310 |
ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
267 |
ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
|
311 |
: QWidget(parent), m_config(config)
|
268 |
: QWidget(parent), m_config(config)
|
312 |
{
|
269 |
{
|
313 |
QVBOXLAYOUT *vboxLayout = new QVBOXLAYOUT(this);
|
270 |
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
|
314 |
vboxLayout->setSpacing(spacing);
|
271 |
vboxLayout->setSpacing(spacing);
|
315 |
vboxLayout->setMargin(margin);
|
272 |
vboxLayout->setMargin(margin);
|
316 |
|
273 |
|
317 |
ConfLink lnksubkeydirs(new ConfLinkNullRep());
|
274 |
ConfLink lnksubkeydirs(new ConfLinkNullRep());
|
318 |
m_subdirs = new
|
275 |
m_subdirs = new
|
319 |
ConfParamDNLW(this, lnksubkeydirs,
|
276 |
ConfParamDNLW(this, lnksubkeydirs,
|
320 |
QObject::tr("<b>Customised subtrees"),
|
277 |
QObject::tr("<b>Customised subtrees"),
|
321 |
QObject::tr("The list of subdirectories in the indexed "
|
278 |
QObject::tr("The list of subdirectories in the indexed "
|
322 |
"hierarchy <br>where some parameters need "
|
279 |
"hierarchy <br>where some parameters need "
|
323 |
"to be redefined. Default: empty."));
|
280 |
"to be redefined. Default: empty."));
|
324 |
m_subdirs->getListBox()->setSelectionMode(QLISTBOX::Single);
|
281 |
m_subdirs->getListBox()->setSelectionMode(QAbstractItemView::SingleSelection);
|
325 |
connect(m_subdirs->getListBox(), SIGNAL(selectionChanged()),
|
282 |
connect(m_subdirs->getListBox(),
|
326 |
this, SLOT(subDirChanged()));
|
283 |
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
|
|
|
284 |
this,
|
|
|
285 |
SLOT(subDirChanged(QListWidgetItem *, QListWidgetItem *)));
|
327 |
connect(m_subdirs, SIGNAL(entryDeleted(QString)),
|
286 |
connect(m_subdirs, SIGNAL(entryDeleted(QString)),
|
328 |
this, SLOT(subDirDeleted(QString)));
|
287 |
this, SLOT(subDirDeleted(QString)));
|
329 |
list<string> allkeydirs = config->getSubKeys();
|
288 |
list<string> allkeydirs = config->getSubKeys();
|
330 |
QStringList qls;
|
289 |
QStringList qls;
|
331 |
for (list<string>::const_iterator it = allkeydirs.begin();
|
290 |
for (list<string>::const_iterator it = allkeydirs.begin();
|
332 |
it != allkeydirs.end(); it++) {
|
291 |
it != allkeydirs.end(); it++) {
|
333 |
qls.push_back(QString::fromUtf8(it->c_str()));
|
292 |
qls.push_back(QString::fromUtf8(it->c_str()));
|
334 |
}
|
293 |
}
|
335 |
m_subdirs->getListBox()->insertStringList(qls);
|
294 |
m_subdirs->getListBox()->insertItems(0, qls);
|
336 |
vboxLayout->addWidget(m_subdirs);
|
295 |
vboxLayout->addWidget(m_subdirs);
|
337 |
|
296 |
|
338 |
QFRAME *line2 = new QFRAME(this);
|
297 |
QFrame *line2 = new QFrame(this);
|
339 |
line2->setFrameShape(QFRAME::HLine);
|
298 |
line2->setFrameShape(QFrame::HLine);
|
340 |
line2->setFrameShadow(QFRAME::Sunken);
|
299 |
line2->setFrameShadow(QFrame::Sunken);
|
341 |
vboxLayout->addWidget(line2);
|
300 |
vboxLayout->addWidget(line2);
|
342 |
|
301 |
|
343 |
QLabel *explain = new QLabel(this);
|
302 |
QLabel *explain = new QLabel(this);
|
344 |
explain->setText(
|
303 |
explain->setText(
|
345 |
QObject::
|
304 |
QObject::
|
|
... |
|
... |
350 |
"You can add or remove directories by clicking "
|
309 |
"You can add or remove directories by clicking "
|
351 |
"the +/- buttons."));
|
310 |
"the +/- buttons."));
|
352 |
vboxLayout->addWidget(explain);
|
311 |
vboxLayout->addWidget(explain);
|
353 |
|
312 |
|
354 |
|
313 |
|
355 |
m_groupbox = new QGROUPBOX(1, Qt::Horizontal, this);
|
314 |
m_groupbox = new QGroupBox(this);
|
356 |
m_groupbox->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
315 |
setSzPol(m_groupbox, QSizePolicy::Preferred, QSizePolicy::Preferred, 1, 3);
|
357 |
QSizePolicy::Preferred,
|
|
|
358 |
1, // Horizontal stretch
|
|
|
359 |
3, // Vertical stretch
|
|
|
360 |
m_groupbox->sizePolicy().hasHeightForWidth()));
|
|
|
361 |
|
316 |
|
362 |
QWidget *w = new QWidget(m_groupbox);
|
|
|
363 |
QGridLayout *gl1 = new QGridLayout(w);
|
317 |
QGridLayout *gl1 = new QGridLayout(m_groupbox);
|
364 |
gl1->setSpacing(spacing);
|
318 |
gl1->setSpacing(spacing);
|
365 |
gl1->setMargin(margin);
|
319 |
gl1->setMargin(margin);
|
366 |
|
320 |
|
367 |
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
321 |
ConfLink lnkskn(new ConfLinkRclRep(config, "skippedNames", &m_sk));
|
368 |
ConfParamSLW *eskn = new
|
322 |
ConfParamSLW *eskn = new
|
369 |
ConfParamSLW(w, lnkskn,
|
323 |
ConfParamSLW(m_groupbox, lnkskn,
|
370 |
QObject::tr("Skipped names"),
|
324 |
QObject::tr("Skipped names"),
|
371 |
QObject::tr("These are patterns for file or directory "
|
325 |
QObject::tr("These are patterns for file or directory "
|
372 |
" names which should not be indexed."));
|
326 |
" names which should not be indexed."));
|
373 |
eskn->setFsEncoding(true);
|
327 |
eskn->setFsEncoding(true);
|
374 |
m_widgets.push_back(eskn);
|
328 |
m_widgets.push_back(eskn);
|
375 |
#if QT_VERSION < 0x040000
|
|
|
376 |
gl1->addMultiCellWidget(eskn, 0, 0, 0, 1);
|
|
|
377 |
#else
|
|
|
378 |
gl1->addWidget(eskn, 0, 0, 1, 2);
|
329 |
gl1->addWidget(eskn, 0, 0, 1, 2);
|
379 |
#endif
|
|
|
380 |
|
330 |
|
381 |
list<string> args;
|
331 |
list<string> args;
|
382 |
args.push_back("-l");
|
332 |
args.push_back("-l");
|
383 |
ExecCmd ex;
|
333 |
ExecCmd ex;
|
384 |
string icout;
|
334 |
string icout;
|
|
... |
|
... |
397 |
charsets.push_back(QString::fromUtf8(it->c_str()));
|
347 |
charsets.push_back(QString::fromUtf8(it->c_str()));
|
398 |
}
|
348 |
}
|
399 |
|
349 |
|
400 |
ConfLink lnk21(new ConfLinkRclRep(config, "defaultcharset", &m_sk));
|
350 |
ConfLink lnk21(new ConfLinkRclRep(config, "defaultcharset", &m_sk));
|
401 |
ConfParamCStrW *e21 = new
|
351 |
ConfParamCStrW *e21 = new
|
402 |
ConfParamCStrW(w, lnk21,
|
352 |
ConfParamCStrW(m_groupbox, lnk21,
|
403 |
QObject::tr("Default character set"),
|
353 |
QObject::tr("Default character set"),
|
404 |
QObject::tr("This is the character set used for reading files "
|
354 |
QObject::tr("This is the character set used for reading files "
|
405 |
"which do not identify the character set "
|
355 |
"which do not identify the character set "
|
406 |
"internally, for example pure text files.<br>"
|
356 |
"internally, for example pure text files.<br>"
|
407 |
"The default value is empty, "
|
357 |
"The default value is empty, "
|
408 |
"and the value from the NLS environnement is used."
|
358 |
"and the value from the NLS environnement is used."
|
409 |
), charsets);
|
359 |
), charsets);
|
410 |
m_widgets.push_back(e21);
|
360 |
m_widgets.push_back(e21);
|
411 |
#if QT_VERSION < 0x040000
|
|
|
412 |
gl1->addMultiCellWidget(e21, 1, 1, 0, 1);
|
|
|
413 |
#else
|
|
|
414 |
gl1->addWidget(e21, 1, 0, 1, 2);
|
361 |
gl1->addWidget(e21, 1, 0, 1, 2);
|
415 |
#endif
|
|
|
416 |
|
362 |
|
417 |
ConfLink lnk3(new ConfLinkRclRep(config, "followLinks", &m_sk));
|
363 |
ConfLink lnk3(new ConfLinkRclRep(config, "followLinks", &m_sk));
|
418 |
ConfParamBoolW *e3 = new
|
364 |
ConfParamBoolW *e3 = new
|
419 |
ConfParamBoolW(w, lnk3,
|
365 |
ConfParamBoolW(m_groupbox, lnk3,
|
420 |
QObject::tr("Follow symbolic links"),
|
366 |
QObject::tr("Follow symbolic links"),
|
421 |
QObject::tr("Follow symbolic links while "
|
367 |
QObject::tr("Follow symbolic links while "
|
422 |
"indexing. The default is no, "
|
368 |
"indexing. The default is no, "
|
423 |
"to avoid duplicate indexing"));
|
369 |
"to avoid duplicate indexing"));
|
424 |
m_widgets.push_back(e3);
|
370 |
m_widgets.push_back(e3);
|
425 |
gl1->addWidget(e3, 2, 0);
|
371 |
gl1->addWidget(e3, 2, 0);
|
426 |
|
372 |
|
427 |
ConfLink lnkafln(new ConfLinkRclRep(config, "indexallfilenames", &m_sk));
|
373 |
ConfLink lnkafln(new ConfLinkRclRep(config, "indexallfilenames", &m_sk));
|
428 |
ConfParamBoolW *eafln = new
|
374 |
ConfParamBoolW *eafln = new
|
429 |
ConfParamBoolW(w, lnkafln,
|
375 |
ConfParamBoolW(m_groupbox, lnkafln,
|
430 |
QObject::tr("Index all file names"),
|
376 |
QObject::tr("Index all file names"),
|
431 |
QObject::tr("Index the names of files for which the contents "
|
377 |
QObject::tr("Index the names of files for which the contents "
|
432 |
"cannot be identified or processed (no or "
|
378 |
"cannot be identified or processed (no or "
|
433 |
"unsupported mime type). Default true"));
|
379 |
"unsupported mime type). Default true"));
|
434 |
m_widgets.push_back(eafln);
|
380 |
m_widgets.push_back(eafln);
|
435 |
gl1->addWidget(eafln, 2, 1);
|
381 |
gl1->addWidget(eafln, 2, 1);
|
436 |
|
382 |
|
437 |
ConfLink lnkzfmaxkbs(new ConfLinkRclRep(config, "compressedfilemaxkbs"));
|
383 |
ConfLink lnkzfmaxkbs(new ConfLinkRclRep(config, "compressedfilemaxkbs"));
|
438 |
ConfParamIntW *ezfmaxkbs = new
|
384 |
ConfParamIntW *ezfmaxkbs = new
|
439 |
ConfParamIntW(w, lnkzfmaxkbs,
|
385 |
ConfParamIntW(m_groupbox, lnkzfmaxkbs,
|
440 |
tr("Max. compressed file size (KB)"),
|
386 |
tr("Max. compressed file size (KB)"),
|
441 |
tr("This value sets a threshold beyond which compressed"
|
387 |
tr("This value sets a threshold beyond which compressed"
|
442 |
"files will not be processed. Set to -1 for no "
|
388 |
"files will not be processed. Set to -1 for no "
|
443 |
"limit, to 0 for no decompression ever."),
|
389 |
"limit, to 0 for no decompression ever."),
|
444 |
-1, 1000000, -1);
|
390 |
-1, 1000000, -1);
|
445 |
m_widgets.push_back(ezfmaxkbs);
|
391 |
m_widgets.push_back(ezfmaxkbs);
|
446 |
gl1->addWidget(ezfmaxkbs, 3, 0);
|
392 |
gl1->addWidget(ezfmaxkbs, 3, 0);
|
447 |
|
393 |
|
448 |
ConfLink lnktxtmaxmbs(new ConfLinkRclRep(config, "textfilemaxmbs"));
|
394 |
ConfLink lnktxtmaxmbs(new ConfLinkRclRep(config, "textfilemaxmbs"));
|
449 |
ConfParamIntW *etxtmaxmbs = new
|
395 |
ConfParamIntW *etxtmaxmbs = new
|
450 |
ConfParamIntW(w, lnktxtmaxmbs,
|
396 |
ConfParamIntW(m_groupbox, lnktxtmaxmbs,
|
451 |
tr("Max. text file size (MB)"),
|
397 |
tr("Max. text file size (MB)"),
|
452 |
tr("This value sets a threshold beyond which text "
|
398 |
tr("This value sets a threshold beyond which text "
|
453 |
"files will not be processed. Set to -1 for no "
|
399 |
"files will not be processed. Set to -1 for no "
|
454 |
"limit. \nThis is for excluding monster "
|
400 |
"limit. \nThis is for excluding monster "
|
455 |
"log files from the index."),
|
401 |
"log files from the index."),
|
|
... |
|
... |
457 |
m_widgets.push_back(etxtmaxmbs);
|
403 |
m_widgets.push_back(etxtmaxmbs);
|
458 |
gl1->addWidget(etxtmaxmbs, 3, 1);
|
404 |
gl1->addWidget(etxtmaxmbs, 3, 1);
|
459 |
|
405 |
|
460 |
ConfLink lnktxtpagekbs(new ConfLinkRclRep(config, "textfilepagekbs"));
|
406 |
ConfLink lnktxtpagekbs(new ConfLinkRclRep(config, "textfilepagekbs"));
|
461 |
ConfParamIntW *etxtpagekbs = new
|
407 |
ConfParamIntW *etxtpagekbs = new
|
462 |
ConfParamIntW(w, lnktxtpagekbs,
|
408 |
ConfParamIntW(m_groupbox, lnktxtpagekbs,
|
463 |
tr("Text file page size (KB)"),
|
409 |
tr("Text file page size (KB)"),
|
464 |
tr("If this value is set (not equal to -1), text "
|
410 |
tr("If this value is set (not equal to -1), text "
|
465 |
"files will be split in chunks of this size for "
|
411 |
"files will be split in chunks of this size for "
|
466 |
"indexing.\nThis will help searching very big text "
|
412 |
"indexing.\nThis will help searching very big text "
|
467 |
" files (ie: log files)."),
|
413 |
" files (ie: log files)."),
|
|
... |
|
... |
469 |
m_widgets.push_back(etxtpagekbs);
|
415 |
m_widgets.push_back(etxtpagekbs);
|
470 |
gl1->addWidget(etxtpagekbs, 4, 0);
|
416 |
gl1->addWidget(etxtpagekbs, 4, 0);
|
471 |
|
417 |
|
472 |
ConfLink lnkfiltmaxsecs(new ConfLinkRclRep(config, "filtermaxseconds"));
|
418 |
ConfLink lnkfiltmaxsecs(new ConfLinkRclRep(config, "filtermaxseconds"));
|
473 |
ConfParamIntW *efiltmaxsecs = new
|
419 |
ConfParamIntW *efiltmaxsecs = new
|
474 |
ConfParamIntW(w, lnkfiltmaxsecs,
|
420 |
ConfParamIntW(m_groupbox, lnkfiltmaxsecs,
|
475 |
tr("Max. filter exec. time (S)"),
|
421 |
tr("Max. filter exec. time (S)"),
|
476 |
tr("External filters working longer than this will be "
|
422 |
tr("External filters working longer than this will be "
|
477 |
"aborted. This is for the rare case (ie: postscript) "
|
423 |
"aborted. This is for the rare case (ie: postscript) "
|
478 |
"where a document could cause a filter to loop"
|
424 |
"where a document could cause a filter to loop"
|
479 |
"Set to -1 for no limit.\n"),
|
425 |
"Set to -1 for no limit.\n"),
|
480 |
-1, 10000);
|
426 |
-1, 10000);
|
481 |
m_widgets.push_back(efiltmaxsecs);
|
427 |
m_widgets.push_back(efiltmaxsecs);
|
482 |
gl1->addWidget(efiltmaxsecs, 4, 1);
|
428 |
gl1->addWidget(efiltmaxsecs, 4, 1);
|
483 |
|
429 |
|
484 |
vboxLayout->addWidget(m_groupbox);
|
430 |
vboxLayout->addWidget(m_groupbox);
|
485 |
subDirChanged();
|
431 |
subDirChanged(0, 0);
|
486 |
}
|
432 |
}
|
487 |
|
433 |
|
488 |
void ConfSubPanelW::reloadAll()
|
434 |
void ConfSubPanelW::reloadAll()
|
489 |
{
|
435 |
{
|
490 |
for (list<ConfParamW*>::iterator it = m_widgets.begin();
|
436 |
for (list<ConfParamW*>::iterator it = m_widgets.begin();
|
491 |
it != m_widgets.end(); it++) {
|
437 |
it != m_widgets.end(); it++) {
|
492 |
(*it)->loadValue();
|
438 |
(*it)->loadValue();
|
493 |
}
|
439 |
}
|
494 |
}
|
440 |
}
|
495 |
|
441 |
|
496 |
void ConfSubPanelW::subDirChanged()
|
442 |
void ConfSubPanelW::subDirChanged(QListWidgetItem *current, QListWidgetItem *)
|
497 |
{
|
443 |
{
|
498 |
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
|
444 |
LOGDEB(("ConfSubPanelW::subDirChanged\n"));
|
499 |
QLISTBOXITEM *item = m_subdirs->getListBox()->selectedItem();
|
445 |
|
500 |
if (item == 0 || item->text() == "") {
|
446 |
if (current == 0 || current->text() == "") {
|
501 |
m_sk = "";
|
447 |
m_sk = "";
|
502 |
m_groupbox->setTitle(tr("Global"));
|
448 |
m_groupbox->setTitle(tr("Global"));
|
503 |
} else {
|
449 |
} else {
|
504 |
m_sk = (const char *)item->text().utf8();
|
450 |
m_sk = (const char *) current->text().toUtf8();
|
505 |
m_groupbox->setTitle(item->text());
|
451 |
m_groupbox->setTitle(current->text());
|
506 |
}
|
452 |
}
|
507 |
LOGDEB(("ConfSubPanelW::subDirChanged: now [%s]\n", m_sk.c_str()));
|
453 |
LOGDEB(("ConfSubPanelW::subDirChanged: now [%s]\n", m_sk.c_str()));
|
508 |
reloadAll();
|
454 |
reloadAll();
|
509 |
}
|
455 |
}
|
510 |
|
456 |
|
511 |
void ConfSubPanelW::subDirDeleted(QString sbd)
|
457 |
void ConfSubPanelW::subDirDeleted(QString sbd)
|
512 |
{
|
458 |
{
|
513 |
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.utf8()));
|
459 |
LOGDEB(("ConfSubPanelW::subDirDeleted(%s)\n", (const char *)sbd.toUtf8()));
|
514 |
if (sbd == "") {
|
460 |
if (sbd == "") {
|
515 |
// Can't do this, have to reinsert it
|
461 |
// Can't do this, have to reinsert it
|
516 |
QTimer::singleShot(0, this, SLOT(restoreEmpty()));
|
462 |
QTimer::singleShot(0, this, SLOT(restoreEmpty()));
|
517 |
return;
|
463 |
return;
|
518 |
}
|
464 |
}
|
519 |
// Have to delete all entries for submap
|
465 |
// Have to delete all entries for submap
|
520 |
m_config->eraseKey((const char *)sbd.utf8());
|
466 |
m_config->eraseKey((const char *)sbd.toUtf8());
|
521 |
}
|
467 |
}
|
522 |
|
468 |
|
523 |
void ConfSubPanelW::restoreEmpty()
|
469 |
void ConfSubPanelW::restoreEmpty()
|
524 |
{
|
470 |
{
|
525 |
LOGDEB(("ConfSubPanelW::restoreEmpty()\n"));
|
471 |
LOGDEB(("ConfSubPanelW::restoreEmpty()\n"));
|
526 |
m_subdirs->getListBox()->insertItem("", 0);
|
472 |
m_subdirs->getListBox()->insertItem(0, "");
|
527 |
}
|
473 |
}
|
528 |
|
474 |
|
529 |
} // Namespace confgui
|
475 |
} // Namespace confgui
|