Trying to fix avatar file name charset issue #44

This commit is contained in:
lotodore
2011-02-04 21:14:49 +00:00
parent ca25c35b94
commit 8c9a17f7db
4 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ public:
bool Init(const std::string &dataDir, const std::string &cacheDir);
void AddSingleAvatar(const std::string &fileName);
bool AddSingleAvatar(const std::string &fileName);
static boost::shared_ptr<AvatarFileState> OpenAvatarFileForChunkRead(const std::string &fileName, unsigned &outFileSize, AvatarFileType &outFileType);
static unsigned ChunkReadAvatarFile(boost::shared_ptr<AvatarFileState> fileState, unsigned char *data, unsigned chunkSize);
+4 -1
View File
@@ -98,9 +98,10 @@ AvatarManager::Init(const string &dataDir, const string &cacheDir)
return retVal;
}
void
bool
AvatarManager::AddSingleAvatar(const std::string &fileName)
{
bool retVal = false;
path filePath(fileName);
string tmpFileName(filePath.file_string());
@@ -120,9 +121,11 @@ AvatarManager::AddSingleAvatar(const std::string &fileName)
{
boost::mutex::scoped_lock lock(m_avatarsMutex);
m_avatars.insert(AvatarMap::value_type(md5buf, tmpFileName));
retVal = true;
}
}
}
return retVal;
}
boost::shared_ptr<AvatarFileState>
+1 -1
View File
@@ -630,7 +630,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
}
//Add avatar (if set)
myStartWindow->getSession()->addOwnAvatar(myConfig->readConfigString("MyAvatar"));
myStartWindow->getSession()->addOwnAvatar(QString::fromUtf8(myConfig->readConfigString("MyAvatar").c_str()).toLocal8Bit().constData());
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
if (mySettingsDialog->getPlayerNickIsChanged() && myStartWindow->getSession()->getCurrentGame() && !myStartWindow->getSession()->isNetworkClientRunning()) {
+2 -2
View File
@@ -25,7 +25,7 @@ QtHelper::~QtHelper()
std::string QtHelper::stringToUtf8(const std::string &myString) {
QString tmpString = QString::fromStdString(myString);
QString tmpString = QString::fromLocal8Bit(myString.c_str());
std::string myUtf8String = tmpString.toUtf8().constData();
return myUtf8String;
@@ -34,7 +34,7 @@ std::string QtHelper::stringToUtf8(const std::string &myString) {
std::string QtHelper::stringFromUtf8(const std::string &myString) {
QString tmpString = QString::fromUtf8(myString.c_str());
return tmpString.toStdString();
return tmpString.toLocal8Bit().constData();
}
std::string QtHelper::getDefaultLanguage() { return QLocale::system().name().toStdString(); }