X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2Fvv.cxx;h=301521b4662a8509197d81174b348964b4e5e140;hb=41321d5733a965fdf2df532e9fc17fb8e52995b3;hp=93b708e753b40aad059ce6ac8d5481ce3c2b5b7d;hpb=bca9dd03f26ae0e48378d756e9981ff63ca7b760;p=clitk.git diff --git a/vv/vv.cxx b/vv/vv.cxx index 93b708e..301521b 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -62,7 +62,7 @@ std::string create_timed_string() } //------------------------------------------------------------------------------ -#ifdef _WIN32 +#ifdef _WIN32 int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine, int nShowCmd) { int argc = __argc; @@ -76,6 +76,23 @@ int main( int argc, char** argv ) QApplication app( argc, argv ); Q_INIT_RESOURCE(vvIcons); + + // + // ATTENTION: Rômulo Pinho - 05/08/2011 + // Forcing the locale of the application is necessary + // because QT initialization changes it to the locale + // of the language of the system. This can cause + // inconsistencies when, e.g., reading float values + // from DICOM fields with gdcm, since the decimal + // point may be changed for a comma (as in French). + // In practice, functions such as scanf and its + // variations are directly affected. + // https://bugreports.qt.nokia.com//browse/QTBUG-15247?page=com.atlassian.jira.plugin.system.issuetabpanels%253Achangehistory-tabpanel + // +#ifndef _WIN32 + std::string old_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "POSIX"); +#endif vvMainWindow window; @@ -175,9 +192,17 @@ int main( int argc, char** argv ) } if(win!="" && lev!="") { - window.WindowLevelChanged(atof(win.c_str()), atof(lev.c_str()), 6, 0); + window.SetWindowLevel(atof(win.c_str()), atof(lev.c_str())); window.ApplyWindowLevelToAllImages(); } - return app.exec(); + + int ret = app.exec(); + +#ifndef _WIN32 + // restoring the locale, just to be clean... + setlocale(LC_NUMERIC, old_locale.c_str()); +#endif + + return ret; }