0032709: Samples, MFC - remove samples Viewer2d, Viewer3d, Ocaf, Triangulation, Anima...
[occt.git] / samples / qt / Tutorial / src / Main.cxx
CommitLineData
7fd59977 1#include "ApplicationTut.h"
2
1fa16152 3#include <OSD_Environment.hxx>
4
55a40de8 5#include <Standard_WarningsDisable.hxx>
7fd59977 6#include <QApplication>
7#include <QTranslator>
55a40de8 8#include <Standard_WarningsRestore.hxx>
7fd59977 9
10int main ( int argc, char* argv[] )
11{
1fa16152 12#if QT_VERSION > 0x050000
13 TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
14 if (!aPlugindsDirName.IsEmpty())
15 QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
16#endif
7fd59977 17 QApplication a( argc, argv );
18
19 QString resDir = ApplicationCommonWindow::getResourceDir();
20 QString resTutDir = ApplicationTut::getTutResourceDir();
21
22 QTranslator strTrans( 0 );
23 Standard_Boolean isOK = strTrans.load( "Common-string", resDir );
24 if( isOK )
25 a.installTranslator( &strTrans );
26
27 QTranslator iconTrans( 0 );
28 isOK = iconTrans.load( "Common-icon", resDir );
29 if( isOK )
30 a.installTranslator( &iconTrans );
31
32 QTranslator strTutTrans( 0 );
33 isOK = strTutTrans.load( "Tutorial-string", resTutDir );
34 if( isOK )
35 a.installTranslator( &strTutTrans );
36
37 QTranslator iconTutTrans( 0 );
38 isOK = iconTutTrans.load( "Tutorial-icon", resTutDir );
39 if( isOK )
40 a.installTranslator( &iconTutTrans );
41
42 QObject::connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
43
44 ApplicationTut* mw = new ApplicationTut();
45 mw->setWindowTitle( QObject::tr( "TIT_SAMPLE" ) );
46 QString aResName( resDir + QString( "/" ) + QObject::tr( "ICON_SAMPLE" ) );
47 mw->setWindowIcon( QPixmap( aResName ) );
48
49 mw->show();
50
51 return a.exec();
52}