| 17 | using QtNodes::ConnectionStyle; |
| 18 | |
| 19 | int |
| 20 | main(int argc, char *argv[]) |
| 21 | { |
| 22 | QApplication app(argc, argv); |
| 23 | app.setApplicationName("Groot"); |
| 24 | app.setWindowIcon(QPixmap(":/icons/BT.png")); |
| 25 | app.setOrganizationName("EurecatRobotics"); |
| 26 | app.setOrganizationDomain("eurecat.org"); |
| 27 | |
| 28 | qRegisterMetaType<AbsBehaviorTree>(); |
| 29 | |
| 30 | QCommandLineParser parser; |
| 31 | parser.setApplicationDescription("Groot. The fancy BehaviorTree Editor"); |
| 32 | parser.addHelpOption(); |
| 33 | |
| 34 | QCommandLineOption test_option(QStringList() << "t" << "test", |
| 35 | "Load dummy data"); |
| 36 | parser.addOption(test_option); |
| 37 | |
| 38 | QCommandLineOption mode_option(QStringList() << "mode", |
| 39 | "Start in one of these modes: [editor,monitor,replay]", |
| 40 | "mode"); |
| 41 | parser.addOption(mode_option); |
| 42 | parser.process( app ); |
| 43 | |
| 44 | QFile styleFile( ":/stylesheet.qss" ); |
| 45 | styleFile.open( QFile::ReadOnly ); |
| 46 | QString style( styleFile.readAll() ); |
| 47 | app.setStyleSheet( style ); |
| 48 | |
| 49 | if( parser.isSet(test_option) ) |
| 50 | { |
| 51 | MainWindow win( GraphicMode::EDITOR ); |
| 52 | win.setWindowTitle("Groot"); |
| 53 | win.show(); |
| 54 | win.loadFromXML( ":/crossdoor_with_subtree.xml" ); |
| 55 | return app.exec(); |
| 56 | } |
| 57 | else{ |
| 58 | auto mode = GraphicMode::EDITOR; |
| 59 | |
| 60 | if( parser.isSet(mode_option) ) |
| 61 | { |
| 62 | QString opt_mode = parser.value(mode_option); |
| 63 | if( opt_mode == "editor") |
| 64 | { |
| 65 | mode = GraphicMode::EDITOR; |
| 66 | } |
| 67 | else if( opt_mode == "monitor") |
| 68 | { |
| 69 | mode = GraphicMode::MONITOR; |
| 70 | } |
| 71 | else if( opt_mode == "replay") |
| 72 | { |
| 73 | mode = GraphicMode::REPLAY; |
| 74 | } |
| 75 | else{ |
| 76 | std::cout << "wrong mode passed to --mode. Use on of these: editor / monitor /replay" |
nothing calls this directly
no test coverage detected