Third round of international character cleanup, see issue #413

This commit is contained in:
Oliver Duis
2010-12-22 20:29:31 +01:00
parent 2ecc32b6f2
commit f4074d050a
6 changed files with 36 additions and 47 deletions

View File

@@ -346,14 +346,17 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
const CacheImageData* cfs=openThm->getCacheImageData();
if (!options.customProfileBuilder.empty() && !openThm->hasProcParams() && cfs && cfs->exifValid) {
// For the filename etc. do NOT use streams, since they are not UTF8 safe
Glib::ustring cmdLine=Glib::ustring("\"") + options.customProfileBuilder + Glib::ustring("\" \"") + openThm->getFileName() + Glib::ustring("\" \"")
+ options.rtdir + Glib::ustring("/") + options.profilePath + Glib::ustring("/") + defProf + Glib::ustring(".pp3") + Glib::ustring("\" ");
// ustring doesn't know int etc formatting, so take these via (unsafe) stream
std::ostringstream strm;
strm << Glib::ustring("\"") << options.customProfileBuilder << Glib::ustring("\" \"") << openThm->getFileName() << Glib::ustring("\" \"");
strm << options.rtdir << Glib::ustring("/") << options.profilePath << Glib::ustring("/") << defProf << Glib::ustring(".pp3");
strm << Glib::ustring("\" ") << cfs->fnumber << Glib::ustring(" ") << cfs->shutter << Glib::ustring(" ");
strm << cfs->fnumber << Glib::ustring(" ") << cfs->shutter << Glib::ustring(" ");
strm << cfs->focalLen << Glib::ustring(" ") << cfs->iso << Glib::ustring(" \"");
strm << cfs->lens << Glib::ustring("\" \"") << cfs->camera << Glib::ustring("\"");
bool success = safe_spawn_command_line_sync (strm.str());
bool success = safe_spawn_command_line_sync (cmdLine + strm.str());
// Now they SHOULD be there, so try to load them
if (success) openThm->loadProcParams();

View File

@@ -42,7 +42,9 @@ void SoundManager::playSoundAsync(const Glib::ustring &sound)
sndParam|=SND_ALIAS;
}
PlaySound(safe_filename_from_utf8(sound).c_str(), NULL, sndParam);
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (sound.c_str(), -1, NULL, NULL, NULL);
PlaySoundW(wfilename, NULL, sndParam);
g_free( wfilename );
#else
// TODO: Add code for other OSes here
printf("Sound not supported on your OS (yet)\n");

View File

@@ -522,7 +522,9 @@ bool Thumbnail::openDefaultViewer(int destination) {
if (destination==1) {
openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormat.format);
if (safe_file_test (openFName, Glib::FILE_TEST_EXISTS)) {
ShellExecute(NULL, "open", openFName.c_str(), NULL, NULL, SW_SHOWMAXIMIZED );
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (openFName.c_str(), -1, NULL, NULL, NULL);
ShellExecuteW(NULL, L"open", wfilename, NULL, NULL, SW_SHOWMAXIMIZED );
g_free(wfilename);
} else {
printf("File not found\n");
return false;
@@ -535,23 +537,26 @@ bool Thumbnail::openDefaultViewer(int destination) {
if (safe_file_test (openFName, Glib::FILE_TEST_EXISTS)) {
// Output file exists, so open explorer and select output file
const char* org=Glib::ustring::compose("/select,\"%1\"", openFName).c_str();
char* par=new char[strlen(org)+1];
strcpy(par, org);
wchar_t* org=(wchar_t*)g_utf8_to_utf16 (Glib::ustring::compose("/select,\"%1\"", openFName).c_str(), -1, NULL, NULL, NULL);
wchar_t* par=new wchar_t[wcslen(org)+1];
wcscpy(par, org);
// In this case the / disturbs
char* p = par+1; // skip the first backslash
wchar_t* p = par+1; // skip the first backslash
while (*p!=0) {
if (*p=='/') *p='\\';
if (*p==L'/') *p=L'\\';
p++;
}
ShellExecute(NULL, "open", "explorer.exe", par, NULL, SW_SHOWNORMAL );
ShellExecuteW(NULL, L"open", L"explorer.exe", par, NULL, SW_SHOWNORMAL );
delete[] par;
g_free(org);
} else if (safe_file_test (Glib::path_get_dirname(openFName), Glib::FILE_TEST_EXISTS)) {
// Out file does not exist, but directory
ShellExecute(NULL, "explore", Glib::path_get_dirname(openFName).c_str(), NULL, NULL, SW_SHOWNORMAL );
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (Glib::path_get_dirname(openFName).c_str(), -1, NULL, NULL, NULL);
ShellExecuteW(NULL, L"explore", wfilename, NULL, NULL, SW_SHOWNORMAL );
g_free(wfilename);
} else {
printf("File and dir not found\n");
return false;