Changeset 7816 for code/forks/sandbox_qt/src
- Timestamp:
- Dec 26, 2010, 5:16:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/forks/sandbox_qt/src/orxonox/Main.cc
r7430 r7816 36 36 #include "Main.h" 37 37 38 #include <memory> 38 39 #include <QApplication> 39 40 #include <QCoreApplication> 40 41 42 #ifdef ORXONOX_PLATFORM_WINDOWS 43 # include <windows.h> 44 #endif 45 41 46 #include "util/Debug.h" 47 #include "util/Exception.h" 42 48 #include "core/CommandLineParser.h" 43 49 #include "core/Core.h" … … 57 63 QApplication app(argc, argv); 58 64 59 QStringList arguments = QCoreApplication::arguments(); 60 if (!arguments.value(0).isEmpty() && arguments.value(0)[0] != '-') 61 arguments.pop_front(); // Remove application path 62 Core core(arguments.join(" ").toStdString()); 65 std::auto_ptr<Core> core; 66 try 67 { 68 QStringList arguments = QCoreApplication::arguments(); 69 if (!arguments.value(0).isEmpty() && arguments.value(0)[0] != '-') 70 arguments.pop_front(); // Remove application path 71 core.reset(new Core(arguments.join(" ").toStdString())); 72 } 73 catch (const Exception& ex) 74 { 75 COUT(0) << "Exception: " << ex.getDescription() << endl; 76 #ifdef ORXONOX_PLATFORM_WINDOWS 77 MessageBox(NULL, ex.getDescription().c_str(), "Exception", MB_ICONERROR); 78 #endif 79 return 1; 80 } 63 81 64 82 QCoreApplication::setOrganizationName("Orxonox"); … … 71 89 QCoreApplication::setApplicationVersion(versionString); 72 90 73 if (CommandLineParser::getValue("generateDoc").toString().isEmpty()) 91 // Define library path 92 // Note: May not work (untested) because QApplication was already created. 93 // However doing the beforehand is difficult because the Core is required. 94 QStringList libraryPaths = QCoreApplication::libraryPaths(); 95 libraryPaths.prepend(PathConfig::getExecutablePath().path() + "/plugins"); 96 QCoreApplication::setLibraryPaths(libraryPaths); 97 98 try 74 99 { 75 MainWindow window; 76 window.show(); 77 return app.exec(); 100 if (CommandLineParser::getValue("generateDoc").toString().isEmpty()) 101 { 102 MainWindow window; 103 window.show(); 104 return app.exec(); 105 } 106 else 107 return 0; 78 108 } 79 else 80 return 0; 109 catch (const Exception& ex) 110 { 111 COUT(0) << "Exception: " << ex.getDescription() << endl; 112 #ifdef ORXONOX_PLATFORM_WINDOWS 113 MessageBox(NULL, ex.getDescription().c_str(), "Exception", MB_ICONERROR); 114 #endif 115 return 1; 116 } 81 117 } 82 118 }
Note: See TracChangeset
for help on using the changeset viewer.