Example #1
0
void ApplicationSettings::parse()
{
    QCommandLineParser parser;
    parser.setApplicationDescription(QObject::tr("i-score - An interactive sequencer for the intermedia arts."));
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("file", QCoreApplication::translate("main", "Scenario to load."));

    QCommandLineOption noGUI("no-gui", QCoreApplication::translate("main", "Disable GUI"));
    parser.addOption(noGUI);
    QCommandLineOption noRestore("no-restore", QCoreApplication::translate("main", "Disable auto-restore"));
    parser.addOption(noRestore);

    QCommandLineOption autoplayOpt("autoplay", QCoreApplication::translate("main", "Auto-play the loaded scenario"));
    parser.addOption(autoplayOpt);

    parser.process(*qApp);

    const QStringList args = parser.positionalArguments();

    tryToRestore = !parser.isSet(noRestore);
    gui = !parser.isSet(noGUI);
    autoplay = parser.isSet(autoplayOpt) && args.size() == 1;

    if(!args.empty() && QFile::exists(args[0]))
    {
        loadList.push_back(args[0]);
    }
}
Example #2
0
void ApplicationSettings::parse(QStringList cargs, int& argc, char** argv)
{
  QCommandLineParser parser;
  parser.setApplicationDescription(QObject::tr(
      "score - An interactive sequencer for the intermedia arts."));
  parser.addHelpOption();
  parser.addVersionOption();
  parser.addPositionalArgument(
      "file", QCoreApplication::translate("main", "Scenario to load."));

  QCommandLineOption noGUI(
      "no-gui", QCoreApplication::translate("main", "Disable GUI"));
  parser.addOption(noGUI);
  QCommandLineOption noRestore(
      "no-restore",
      QCoreApplication::translate("main", "Disable auto-restore"));
  parser.addOption(noRestore);

  QCommandLineOption autoplayOpt(
      "autoplay",
      QCoreApplication::translate("main", "Auto-play the loaded scenario"));
  parser.addOption(autoplayOpt);

  if (cargs.contains("--help") || cargs.contains("--version"))
  {
    QCoreApplication app(argc, argv);
    setQApplicationMetadata();
    parser.process(cargs);
    exit(0);
  }
  else
  {
    parser.process(cargs);
  }

  const QStringList args = parser.positionalArguments();

  tryToRestore = !parser.isSet(noRestore);
  gui = !parser.isSet(noGUI);
  if (!gui)
    tryToRestore = false;
  autoplay = parser.isSet(autoplayOpt) && args.size() == 1;

  if (!args.empty() && QFile::exists(args[0]))
  {
    loadList.push_back(args[0]);
  }
}
Example #3
0
int main(int argc, char* argv[])
{
    // Start the application without a GUI
    if (argc > 1 && !strcmp(argv[1], "--no-gui"))
    {
        NoGUI noGUI(argc, argv);
        noGUI.Run();
        return 0;
    }

    // Start the Qt GUI
    QApplication app(argc, argv);
    MainWindow mw;
    mw.show();
    return app.exec();
}