Windows:confgui: process windows file names as unicode, no local8bit
This commit is contained in:
parent
30f37f0e23
commit
21b918d447
@ -56,9 +56,12 @@ static const int margin = 2;
|
||||
|
||||
void ConfParamW::setValue(const QString& value)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
// On Windows all paths are unicode.
|
||||
if (m_fsencoding)
|
||||
m_cflink->set(string((const char *)value.toLocal8Bit()));
|
||||
else
|
||||
#endif
|
||||
m_cflink->set(string((const char *)value.toUtf8()));
|
||||
}
|
||||
|
||||
@ -158,9 +161,12 @@ void ConfParamStrW::loadValue()
|
||||
{
|
||||
string s;
|
||||
m_cflink->get(s);
|
||||
#ifndef _WIN32
|
||||
// On Windows all paths are unicode.
|
||||
if (m_fsencoding)
|
||||
m_le->setText(QString::fromLocal8Bit(s.c_str()));
|
||||
else
|
||||
#endif
|
||||
m_le->setText(QString::fromUtf8(s.c_str()));
|
||||
}
|
||||
|
||||
@ -191,9 +197,12 @@ void ConfParamCStrW::loadValue()
|
||||
string s;
|
||||
m_cflink->get(s);
|
||||
QString cs;
|
||||
#ifndef _WIN32
|
||||
// On Windows all paths are unicode.
|
||||
if (m_fsencoding)
|
||||
cs = QString::fromLocal8Bit(s.c_str());
|
||||
else
|
||||
#endif
|
||||
cs = QString::fromUtf8(s.c_str());
|
||||
|
||||
for (int i = 0; i < m_cmb->count(); i++) {
|
||||
@ -272,7 +281,12 @@ void ConfParamFNW::loadValue()
|
||||
{
|
||||
string s;
|
||||
m_cflink->get(s);
|
||||
#ifndef _WIN32
|
||||
// On Windows all paths are unicode.
|
||||
m_le->setText(QString::fromLocal8Bit(s.c_str()));
|
||||
#else
|
||||
m_le->setText(QString::fromUtf8(s.c_str()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConfParamFNW::showBrowserDialog()
|
||||
@ -346,9 +360,12 @@ void ConfParamSLW::loadValue()
|
||||
stringToStrings(s, ls);
|
||||
QStringList qls;
|
||||
for (list<string>::const_iterator it = ls.begin(); it != ls.end(); it++) {
|
||||
// On Windows all paths are unicode.
|
||||
#ifndef _WIN32
|
||||
if (m_fsencoding)
|
||||
qls.push_back(QString::fromLocal8Bit(it->c_str()));
|
||||
else
|
||||
#endif
|
||||
qls.push_back(QString::fromUtf8(it->c_str()));
|
||||
}
|
||||
m_lb->clear();
|
||||
@ -379,7 +396,7 @@ void ConfParamSLW::showInputDialog()
|
||||
void ConfParamSLW::listToConf()
|
||||
{
|
||||
list<string> ls;
|
||||
LOGDEB2("ConfParamSLW::listToConf. m_fsencoding " << (int(m_fsencoding)) << "\n" );
|
||||
LOGDEB2("ConfParamSLW::listToConf. m_fsencoding " << m_fsencoding << "\n");
|
||||
for (int i = 0; i < m_lb->count(); i++) {
|
||||
// General parameters are encoded as utf-8. File names as
|
||||
// local8bit There is no hope for 8bit file names anyway
|
||||
@ -390,8 +407,9 @@ void ConfParamSLW::listToConf()
|
||||
// paths, and it will come back to haunt us one day.
|
||||
QString text = m_lb->item(i)->text();
|
||||
if (m_fsencoding) {
|
||||
// On Windows all paths are unicode.
|
||||
#ifdef _WIN32
|
||||
string pth((const char *)(text.toLocal8Bit()));
|
||||
string pth((const char *)(text.toUtf8()));
|
||||
path_slashize(pth);
|
||||
ls.push_back(pth);
|
||||
#else
|
||||
@ -426,7 +444,7 @@ void ConfParamSLW::deleteSelected()
|
||||
}
|
||||
for (vector<int>::reverse_iterator it = idxes.rbegin();
|
||||
it != idxes.rend(); it++) {
|
||||
LOGDEB0("deleteSelected: " << (*it) << " was selected\n" );
|
||||
LOGDEB0("deleteSelected: " << *it << " was selected\n");
|
||||
QListWidgetItem *item = m_lb->takeItem(*it);
|
||||
emit entryDeleted(item->text());
|
||||
delete item;
|
||||
@ -479,4 +497,3 @@ void ConfParamCSLW::showInputDialog()
|
||||
}
|
||||
|
||||
} // Namespace confgui
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user