CommandLineParser::CommandLineParser() : QCommandLineParser() { setApplicationDescription( Alexandra::appDescription ); // "-h" and "--help" addHelpOption(); // "-v" and "--version" addVersionOption(); // Adding films from the command line arguments addPositionalArgument( "films", "Add films to the database.", "[<file1> [<file2> ...]]" ); // "-c" and "--config" configLocationOption = new QCommandLineOption( QStringList() << "c" << "config", "Specify the location of the configuration file.", "/path/to/config" ); addOption( *configLocationOption ); }
int main(int argc, char* argv[]) { try { ma::chrono::ExcelExporter::ThreadInitializer excelExporterInitializer; QApplication application(argc, argv); #if defined(QT_STATIC) || !(defined(QT_DLL) || defined(QT_SHARED)) #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable: 4127) #endif Q_INIT_RESOURCE(chrono); #if defined(_MSC_VER) #pragma warning(pop) #endif #endif setApplicationDescription(application); installSystemLocaleTranslation(application); ma::chrono::registerDatabaseMetaTypes(); ma::chrono::NavigationWindow navigationWindow; adjustDesktopAwareGeometry(navigationWindow); navigationWindow.show(); return application.exec(); } catch (const std::exception& e) { qFatal("Unexpected error: %s", e.what()); } catch (...) { qFatal("Unknown exception"); } }