Adding svn:eol-style=LF property
[occt.git] / samples / qt / Graphic3dDemo / src / Graphic3dDemo.cxx
CommitLineData
7fd59977 1#include <stdlib.h>
2
3#include <qmainwindow.h>
4#include <qapplication.h>
5#include <qtranslator.h>
c6c9371f 6#include <qpixmap.h>
7fd59977 7#include <qtranslator.h>
8
9#include "global.h"
10#include "Application.h"
c6c9371f 11
12#define GLOBAL_CONTEXT "@default"
13
14class Translator : public QTranslator
15{
16public:
17 Translator( QObject* parent = 0 ) : QTranslator( parent ) {}
18 virtual QString translate( const char* context,
19 const char* sourceText,
20 const char* comment = 0 ) const
21 {
22 QString res = QTranslator::translate( context, sourceText, comment );
23 if( res.isNull() )
24 res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment );
25 return res;
26 }
27};
7fd59977 28
29int main(int argc, char* argv[])
30{
31 QApplication a( argc, argv );
32
33 QString dir( getenv( "CSF_ResourcesDefaults" ) );
34
35 Translator msg( 0 ), img( 0 );
36 msg.load( "Sample_msg.qm", dir );
37 a.installTranslator( &msg );
38
39 img.load( "Sample_icons.qm", dir );
40 a.installTranslator( &img );
41
42 QPixmap pix( dir + QString( "/" ) + QObject::tr( "ICON_SAMPLE" ) );
43
44 Application* app = new Application();
45 app->setWindowTitle( QObject::tr( "TIT_SAMPLE" ) );
46 app->setWindowIcon( pix );
47
48 QApplication::setOverrideCursor( Qt::WaitCursor );
c6c9371f 49 app->show();
50 app->InitApp();
7fd59977 51 QApplication::restoreOverrideCursor();
52
53 return a.exec();
54}