|
a/src/qtgui/confgui/confgui.cpp |
|
b/src/qtgui/confgui/confgui.cpp |
|
... |
|
... |
68 |
const static int spacing = 4;
|
68 |
const static int spacing = 4;
|
69 |
const static int margin = 6;
|
69 |
const static int margin = 6;
|
70 |
|
70 |
|
71 |
void ConfParamW::setValue(const QString& value)
|
71 |
void ConfParamW::setValue(const QString& value)
|
72 |
{
|
72 |
{
|
|
|
73 |
if (m_fsencoding)
|
|
|
74 |
m_cflink->set(string((const char *)value.local8Bit()));
|
|
|
75 |
else
|
73 |
m_cflink->set(string((const char *)value.utf8()));
|
76 |
m_cflink->set(string((const char *)value.utf8()));
|
74 |
}
|
77 |
}
|
75 |
|
78 |
|
76 |
void ConfParamW::setValue(int value)
|
79 |
void ConfParamW::setValue(int value)
|
77 |
{
|
80 |
{
|
78 |
char buf[30];
|
81 |
char buf[30];
|
|
... |
|
... |
167 |
|
170 |
|
168 |
void ConfParamStrW::loadValue()
|
171 |
void ConfParamStrW::loadValue()
|
169 |
{
|
172 |
{
|
170 |
string s;
|
173 |
string s;
|
171 |
m_cflink->get(s);
|
174 |
m_cflink->get(s);
|
|
|
175 |
if (m_fsencoding)
|
|
|
176 |
m_le->setText(QString::fromLocal8Bit(s.c_str()));
|
|
|
177 |
else
|
172 |
m_le->setText(QString::fromUtf8(s.c_str()));
|
178 |
m_le->setText(QString::fromUtf8(s.c_str()));
|
173 |
}
|
179 |
}
|
174 |
|
180 |
|
175 |
ConfParamCStrW::ConfParamCStrW(QWidget *parent, ConfLink cflink,
|
181 |
ConfParamCStrW::ConfParamCStrW(QWidget *parent, ConfLink cflink,
|
176 |
const QString& lbltxt,
|
182 |
const QString& lbltxt,
|
177 |
const QString& tltptxt,
|
183 |
const QString& tltptxt,
|
|
... |
|
... |
198 |
|
204 |
|
199 |
void ConfParamCStrW::loadValue()
|
205 |
void ConfParamCStrW::loadValue()
|
200 |
{
|
206 |
{
|
201 |
string s;
|
207 |
string s;
|
202 |
m_cflink->get(s);
|
208 |
m_cflink->get(s);
|
|
|
209 |
QString cs;
|
|
|
210 |
if (m_fsencoding)
|
|
|
211 |
cs = QString::fromLocal8Bit(s.c_str());
|
|
|
212 |
else
|
203 |
QString cs = QString::fromUtf8(s.c_str());
|
213 |
cs = QString::fromUtf8(s.c_str());
|
|
|
214 |
|
204 |
for (int i = 0; i < m_cmb->count(); i++) {
|
215 |
for (int i = 0; i < m_cmb->count(); i++) {
|
205 |
if (!cs.compare(m_cmb->text(i))) {
|
216 |
if (!cs.compare(m_cmb->text(i))) {
|
206 |
m_cmb->setCurrentItem(i);
|
217 |
m_cmb->setCurrentItem(i);
|
207 |
break;
|
218 |
break;
|
208 |
}
|
219 |
}
|
|
... |
|
... |
255 |
: ConfParamW(parent, cflink), m_isdir(isdir)
|
266 |
: ConfParamW(parent, cflink), m_isdir(isdir)
|
256 |
{
|
267 |
{
|
257 |
if (!createCommon(lbltxt, tltptxt))
|
268 |
if (!createCommon(lbltxt, tltptxt))
|
258 |
return;
|
269 |
return;
|
259 |
|
270 |
|
|
|
271 |
m_fsencoding = true;
|
260 |
m_le = new QLineEdit(this);
|
272 |
m_le = new QLineEdit(this);
|
261 |
m_le->setMinimumSize(QSize(150, 0 ));
|
273 |
m_le->setMinimumSize(QSize(150, 0 ));
|
262 |
m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
274 |
m_le->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,
|
263 |
QSizePolicy::Fixed,
|
275 |
QSizePolicy::Fixed,
|
264 |
1, // Horizontal stretch
|
276 |
1, // Horizontal stretch
|
|
... |
|
... |
283 |
|
295 |
|
284 |
void ConfParamFNW::loadValue()
|
296 |
void ConfParamFNW::loadValue()
|
285 |
{
|
297 |
{
|
286 |
string s;
|
298 |
string s;
|
287 |
m_cflink->get(s);
|
299 |
m_cflink->get(s);
|
288 |
m_le->setText(QString::fromUtf8(s.c_str()));
|
300 |
m_le->setText(QString::fromLocal8Bit(s.c_str()));
|
289 |
}
|
301 |
}
|
290 |
|
302 |
|
291 |
void ConfParamFNW::showBrowserDialog()
|
303 |
void ConfParamFNW::showBrowserDialog()
|
292 |
{
|
304 |
{
|
293 |
QString s = m_isdir ?
|
305 |
QString s = m_isdir ?
|
|
... |
|
... |
364 |
m_cflink->get(s);
|
376 |
m_cflink->get(s);
|
365 |
list<string> ls;
|
377 |
list<string> ls;
|
366 |
stringToStrings(s, ls);
|
378 |
stringToStrings(s, ls);
|
367 |
QStringList qls;
|
379 |
QStringList qls;
|
368 |
for (list<string>::const_iterator it = ls.begin(); it != ls.end(); it++) {
|
380 |
for (list<string>::const_iterator it = ls.begin(); it != ls.end(); it++) {
|
|
|
381 |
if (m_fsencoding)
|
|
|
382 |
qls.push_back(QString::fromLocal8Bit(it->c_str()));
|
|
|
383 |
else
|
369 |
qls.push_back(QString::fromUtf8(it->c_str()));
|
384 |
qls.push_back(QString::fromUtf8(it->c_str()));
|
370 |
}
|
385 |
}
|
371 |
m_lb->clear();
|
386 |
m_lb->clear();
|
372 |
m_lb->insertStringList(qls);
|
387 |
m_lb->insertStringList(qls);
|
373 |
}
|
388 |
}
|
374 |
|
389 |
|
|
... |
|
... |
392 |
|
407 |
|
393 |
void ConfParamSLW::listToConf()
|
408 |
void ConfParamSLW::listToConf()
|
394 |
{
|
409 |
{
|
395 |
list<string> ls;
|
410 |
list<string> ls;
|
396 |
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
411 |
for (unsigned int i = 0; i < m_lb->count(); i++) {
|
|
|
412 |
// General parameters are encoded as utf-8. File names as
|
|
|
413 |
// local8bit There is no hope for 8bit file names anyway
|
|
|
414 |
// except for luck: the original encoding is unknown.
|
|
|
415 |
if (m_fsencoding)
|
|
|
416 |
ls.push_back((const char *)(m_lb->text(i).local8Bit()));
|
|
|
417 |
else
|
397 |
ls.push_back((const char *)m_lb->text(i));
|
418 |
ls.push_back((const char *)(m_lb->text(i).utf8()));
|
398 |
}
|
419 |
}
|
399 |
string s;
|
420 |
string s;
|
400 |
stringsToString(ls, s);
|
421 |
stringsToString(ls, s);
|
401 |
m_cflink->set(s);
|
422 |
m_cflink->set(s);
|
402 |
}
|
423 |
}
|