set C locale for the application by default.
- <b>Language</b>
- <b>Current language</b> - the language used by the application
GUI. The language change will come in force only after the application is restarted.
+ - <b>Use C locale</b> - when checked, the C locale will be set for the application,
+ otherwise a system locale will be used. The locale change will come in force only after
+ the application is restarted.
- <b>Look and feel</b>
- <b>Opaque resize</b> - force opaque resize mode for viewers area (tabbed workspace).
Clear this checkbox for less perfomant workstations.
}
pref->setItemProperty( "strings", aLangs, curLang );
pref->setItemProperty( "icons", aIcons, curLang );
+
+ int curLocale = pref->addPreference( tr( "PREF_CURRENT_LOCALE" ), langGroup,
+ LightApp_Preferences::Bool, "language", "locale" );
// ... "Language" group <<end>>
// ... "Look and feel" group <<start>>
{
SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LANG_CHANGED" ) );
}
+ if ( sec == "language" && param == "locale")
+ {
+ SUIT_MessageBox::information( desktop(), tr( "WRN_WARNING" ), tr( "LOCALE_CHANGED" ) );
+ }
if ( sec == "desktop" && param == "opaque_resize" ) {
bool opaqueResize = resMgr->booleanValue( "desktop", "opaque_resize", false );
QMainWindow::DockOptions dopts = desktop()->dockOptions();
<!-- Language settings (resource manager)-->
<parameter name="languages" value="en,fr,ja"/>
<parameter name="language" value="en"/>
+ <parameter name="locale" value="true"/>
<parameter name="translators" value="%P_msg_%L.qm|%P_icons.qm|%P_images.qm"/>
</section>
<section name="splash" >
<message>
<source>LANG_CHANGED</source>
<translation>Application language has been changed.
+The changes will be applied on the next application session.</translation>
+ </message>
+ <message>
+ <source>LOCALE_CHANGED</source>
+ <translation>Application locale has been changed.
The changes will be applied on the next application session.</translation>
</message>
<message>
<source>PREF_CURRENT_LANGUAGE</source>
<translation>Current language</translation>
</message>
+ <message>
+ <source>PREF_CURRENT_LOCALE</source>
+ <translation>Use C locale</translation>
+ </message>
<message>
<source>PREF_GROUP_LOOK_AND_FEEL</source>
<translation>Look and feel</translation>
#include <stdlib.h>
+/* XPM for the default pixmap */
+static const char* pixmap_not_found_xpm[] = {
+"16 16 3 1",
+" c None",
+". c #000000",
+"+ c #A80000",
+" ",
+" ",
+" . . ",
+" .+. .+. ",
+" .+++. .+++. ",
+" .+++.+++. ",
+" .+++++. ",
+" .+++. ",
+" .+++++. ",
+" .+++.+++. ",
+" .+++. .+++. ",
+" .+. .+. ",
+" . . ",
+" ",
+" ",
+" "};
+
+QPixmap* QtxResourceMgr::myDefaultPix = NULL;
+
/*!
\class QtxResourceMgr::Resources
\internal
QtxResourceMgr::QtxResourceMgr( const QString& appName, const QString& resVarTemplate )
: myAppName( appName ),
myCheckExist( true ),
- myDefaultPix( 0 ),
myIsPixmapCached( true ),
myHasUserValues( true ),
myWorkingMode( AllowUserValues )
qDeleteAll( myResources );
qDeleteAll( myFormats );
-
- delete myDefaultPix;
}
/*!
\return default pixmap
\sa setDefaultPixmap(), loadPixmap()
*/
-QPixmap QtxResourceMgr::defaultPixmap() const
+QPixmap QtxResourceMgr::defaultPixmap()
{
QPixmap res;
+ if(!myDefaultPix)
+ myDefaultPix = new QPixmap( pixmap_not_found_xpm );
+
if ( myDefaultPix && !myDefaultPix->isNull() )
res = *myDefaultPix;
return res;
if ( pix.isNull() )
myDefaultPix = 0;
else
- myDefaultPix = new QPixmap( pix );
+ myDefaultPix = new QPixmap( pix );
}
/*!
{
QString fileName;
QString pathName = QDir::homePath();
-
QString cfgAppName = QApplication::applicationName();
if ( !cfgAppName.isEmpty() )
pathName = Qtx::addSlash( Qtx::addSlash( pathName ) + QString( ".config" ) ) + cfgAppName;
QString option( const QString& ) const;
void setOption( const QString&, const QString& );
- QPixmap defaultPixmap() const;
- virtual void setDefaultPixmap( const QPixmap& );
+ static QPixmap defaultPixmap();
+ static void setDefaultPixmap( const QPixmap& );
QString resSection() const;
QString langSection() const;
ResList myResources; //!< resources list
bool myCheckExist; //!< "check existance" flag
TransListMap myTranslator; //!< map of loaded translators
- QPixmap* myDefaultPix; //!< default icon
+ static QPixmap* myDefaultPix; //!< default icon
bool myIsPixmapCached; //!< "cached pixmaps" flag
bool myHasUserValues; //!< \c true if user preferences has been read
// }
// }
-/* XPM */
-static const char* pixmap_not_found_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #A80000",
-" ",
-" ",
-" . . ",
-" .+. .+. ",
-" .+++. .+++. ",
-" .+++.+++. ",
-" .+++++. ",
-" .+++. ",
-" .+++++. ",
-" .+++.+++. ",
-" .+++. .+++. ",
-" .+. .+. ",
-" . . ",
-" ",
-" ",
-" "};
-
class SUITApp_Session: public SUIT_Session
{
public:
if ( resMgr )
{
- static QPixmap defaultPixmap( pixmap_not_found_xpm );
- resMgr->setDefaultPixmap( defaultPixmap );
resMgr->setOption( "translators", QString( "%P_msg_%L.qm|%P_icons.qm|%P_images.qm" ) );
}
return resMgr;
}
}
-/* XPM */
-static const char* pixmap_not_found_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #A80000",
-" ",
-" ",
-" . . ",
-" .+. .+. ",
-" .+++. .+++. ",
-" .+++.+++. ",
-" .+++++. ",
-" .+++. ",
-" .+++++. ",
-" .+++.+++. ",
-" .+++. .+++. ",
-" .+. .+. ",
-" . . ",
-" ",
-" ",
-" "};
-
QString salomeVersion()
{
return GUI_VERSION_STR;
{
setCurrentFormat( "xml" );
setOption( "translators", QString( "%P_msg_%L.qm|%P_icons.qm|%P_images.qm" ) );
- setDefaultPixmap( QPixmap( pixmap_not_found_xpm ) );
}
static void initResourceMgr()
{
SALOME_Session() : SUIT_Session() {}
virtual ~SALOME_Session() {}
-protected:
+public:
virtual SUIT_ResourceMgr* createResourceMgr( const QString& appName ) const
{
SALOME_ResourceMgr::initResourceMgr();
if ( !qtdir.isEmpty() )
QApplication::addLibraryPath( QDir( qtdir ).absoluteFilePath( "plugins" ) );
+ {
+ SALOME_Session s;
+ QApplication::setApplicationName( "salome" );
+ SUIT_ResourceMgr* resMgr = s.createResourceMgr( "SalomeApp" );
+ bool isCloc = resMgr->booleanValue( "language", "locale", true );
+ if ( isCloc ) {
+ QLocale::setDefault( QLocale::c() );
+ }
+ else {
+ QLocale::setDefault( QLocale::system() );
+ }
+ }
+
// Create Qt application instance;
// this should be done the very first!
SALOME_QApplication _qappl( argc, argv );