1 #include "Application.h" 2 3 #include <OSD_Environment.hxx> 4 5 #include <Standard_WarningsDisable.hxx> 6 #include <QApplication> 7 #include <QTranslator> 8 #include <QPixmap> 9 #include <QLocale> 10 #include <Standard_WarningsRestore.hxx> 11 12 main(int argc,char * argv[])13int main ( int argc, char* argv[] ) 14 { 15 #if QT_VERSION > 0x050000 16 TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value(); 17 if (!aPlugindsDirName.IsEmpty()) 18 QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins"); 19 #endif 20 QApplication a( argc, argv ); 21 22 QString resDir = ApplicationCommonWindow::getResourceDir(); 23 QString resIEDir = ApplicationWindow::getIEResourceDir(); 24 25 QTranslator strTrans( 0 ); 26 Standard_Boolean isOK = strTrans.load( "Common-string", resDir ); 27 if( isOK ) 28 a.installTranslator( &strTrans ); 29 30 QTranslator iconTrans( 0 ); 31 isOK = iconTrans.load( "Common-icon", resDir ); 32 if( isOK ) 33 a.installTranslator( &iconTrans ); 34 35 QTranslator strIETrans( 0 ); 36 isOK = strIETrans.load( "Interface-string", resIEDir ); 37 if( isOK ) 38 a.installTranslator( &strIETrans ); 39 40 QObject::connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); 41 42 ApplicationWindow* mw = new ApplicationWindow(); 43 mw->setWindowTitle( QObject::tr( "TIT_SAMPLE" ) ); 44 mw->setWindowIcon( QPixmap( resDir + QString( "/" ) + QObject::tr( "ICON_SAMPLE" ) ) ); 45 mw->show(); 46 47 return a.exec(); 48 } 49 50