return success;
}
+/*!
+ \class Qtx::Localizer
+ \brief Localization helper
+
+ This helper class can be used to solve the localization problems,
+ usually related to the textual files reading/writing, namely when
+ floating point values are read / written with API functions.
+ The problem relates to such locale specific settings as decimal point
+ separator, thousands separator, etc.
+
+ To use the Localizer class, just create a local variable in the beginning
+ of the code where you need to read / write data from textual file(s).
+ The constructor of the class forces setting "C" locale temporariy.
+ The destructor switches back to the initial locale.
+
+ \code
+ Qtx::Localizer loc;
+ readSomething();
+ writeSomething();
+ \endcode
+*/
+
+/*!
+ \brief Constructor. Forces "C" locale to be set.
+*/
+Qtx::Localizer::Localizer()
+{
+ myCurLocale = setlocale( LC_NUMERIC, 0 );
+ setlocale( LC_NUMERIC, "C" );
+}
+
+/*!
+ \brief Destructor. Reverts back to the initial locale.
+*/
+Qtx::Localizer::~Localizer()
+{
+ setlocale( LC_NUMERIC, myCurLocale.toLatin1().constData() );
+}
+
#ifndef WIN32
#include <X11/Xlib.h>
Auto //!< substitute environment variable by it's value if variable exists, and keep it as is otherwise
} SubstMode;
+ class Localizer
+ {
+ public:
+ Localizer();
+ ~Localizer();
+ private:
+ QString myCurLocale;
+ };
+
static QString toQString( const char*, const int = -1 );
static QString toQString( const short*, const int = -1 );
static QString toQString( const unsigned char*, const int = -1 );
*/
bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
{
+ Qtx::Localizer loc;
return dumpViewToFormat( dumpView(), fileName, format );
}
QString fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 );
if ( !fileName.isEmpty() )
{
- QString fmt = SUIT_Tools::extension( fileName ).toUpper();
- bOk = dumpViewToFormat( im, fileName, fmt );
+ QString fmt = SUIT_Tools::extension( fileName ).toUpper();
+ Qtx::Localizer loc;
+ bOk = dumpViewToFormat( im, fileName, fmt );
}
else
- bOk = true; // cancelled
+ bOk = true; // cancelled
}
if ( !bOk )
SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );