- // We catch SIGTERM and SIGINT (caused by Ctrl+C) to graceful shutdown Quassel.
- signal(SIGTERM, handle_signal);
- signal(SIGINT, handle_signal);
-
- // Logger logger;
-
- Global::registerMetaTypes();
- Global::setupVersion();
-
-#if defined BUILD_CORE
- Global::runMode = Global::CoreOnly;
- QCoreApplication app(argc, argv);
-#elif defined BUILD_QTUI
- Global::runMode = Global::ClientOnly;
- QApplication app(argc, argv);
-#else
- Global::runMode = Global::Monolithic;
- QApplication app(argc, argv);
-#endif
-
- Global::parser = CliParser(QCoreApplication::arguments());
-
-#ifndef BUILD_QTUI
-// put core-only arguments here
- Global::parser.addOption("port",'p',"The port quasselcore will listen at",QString("4242"));
- Global::parser.addSwitch("norestore", 'n', "Don't restore last core's state");
-#endif // BUILD_QTUI
-#ifndef BUILD_CORE
-// put client-only arguments here
- Global::parser.addSwitch("debugbufferswitches",0,"Enables debugging for bufferswitches");
- Global::parser.addSwitch("debugmodel",0,"Enables debugging for models");
-#endif // BUILD_QTCORE
-// put shared client&core arguments here
- Global::parser.addSwitch("debug",'d',"Enable debug output");
- Global::parser.addSwitch("help",'h', "Display this help and exit");
-
- if(!Global::parser.parse() || Global::parser.isSet("help")) {
- Global::parser.usage();
- return 1;
- }
-
- qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
-
- // Set up i18n support
- QLocale locale = QLocale::system();