Exemple #1
1
bool commandLineArgumentsValid(QStringList *positionalArgs,
                               QStringList *ignoreMasks)
{
  bool result = true;

  QCommandLineParser parser;
  parser.setApplicationDescription("Creates patches");
  parser.addHelpOption();
  parser.addVersionOption();
  parser.addPositionalArgument("old",     QCoreApplication::translate("main", "Path to a directory containing old version of files"));
  parser.addPositionalArgument("new",     QCoreApplication::translate("main", "Path to a directory containing new version of files"));
  parser.addPositionalArgument("result",  QCoreApplication::translate("main", "Path to a directory where resulting patch will be stored"));

  QCommandLineOption ignoreOption(QStringList() << "i" << "ignore",
                                  QCoreApplication::translate("main", "Specifies which file or folder to ignore during comparison. Can be used multiple times. e.g. -i .svn -i *.txt"),
                                  QCoreApplication::translate("main", "mask"));
  parser.addOption(ignoreOption);

  // Process the actual command line arguments given by the user
  parser.process(*qApp);

  *positionalArgs = parser.positionalArguments();
  if (positionalArgs->size() < 3)
  {
    fputs(qPrintable(parser.helpText()), stderr);
    result = false;
  }

  *ignoreMasks = parser.values(ignoreOption);

  return result;
}
Exemple #2
1
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName("objects");
    app.setApplicationVersion("0.1");

    QCommandLineParser parser;
    parser.setApplicationDescription("OpenGL objects");
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption objectOption(QStringList() << "o" << "object",
            QCoreApplication::translate("main", "Use object <object>."),
            QCoreApplication::translate("main", "object"),
            QString::fromLatin1("earth.obj"));
    parser.addOption(objectOption);
    QCommandLineOption shaderOption(QStringList() << "s" << "shader",
            QCoreApplication::translate("main", "Use shaders <shader>.[fv].glsl."),
            QCoreApplication::translate("main", "shader"),
            QString::fromLatin1("simple"));
    parser.addOption(shaderOption);
    
    parser.process(app);

#ifndef QT_NO_OPENGL
    MainWidget widget;
    widget.setObject(parser.value(objectOption));
    widget.setShader(parser.value(shaderOption));
    widget.show();
#else
    QLabel note("OpenGL Support required");
    note.show();
#endif
    return app.exec();
}
void AppDelegate::parseCommandLine() {
    QCommandLineParser parser;
    parser.setApplicationDescription("High Fidelity Stack Manager");
    parser.addHelpOption();

    const QCommandLineOption helpOption = parser.addHelpOption();

    const QCommandLineOption hifiBuildDirectoryOption("b", "Path to build of hifi", "build-directory");
    parser.addOption(hifiBuildDirectoryOption);

    if (!parser.parse(QCoreApplication::arguments())) {
        qCritical() << parser.errorText() << endl;
        parser.showHelp();
        Q_UNREACHABLE();
    }

    if (parser.isSet(helpOption)) {
        parser.showHelp();
        Q_UNREACHABLE();
    }

    if (parser.isSet(hifiBuildDirectoryOption)) {
        const QString hifiBuildDirectory = parser.value(hifiBuildDirectoryOption);
        qDebug() << "hifiBuildDirectory=" << hifiBuildDirectory << "\n";
        GlobalData::getInstance().setHifiBuildDirectory(hifiBuildDirectory);
    }
}
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]);
    }
}
Exemple #5
0
int main(int argc, char **argv)
{
	QCoreApplication app(argc, argv);
	QCommandLineParser parser;
	QCoreApplication::setApplicationName("IDFS master node");
	QCoreApplication::setApplicationVersion("1.0");
	parser.setApplicationDescription("Where all file metadata is stored.");
	parser.addHelpOption();
	parser.addVersionOption();
	QCommandLineOption portOption(QStringList() << "p" << "port",
		"Host's port (default is 8001).", "port", "8001");
	parser.addOption(portOption);
	parser.process(app);

	bool ok;
	quint16 port = parser.value(portOption).toUInt(&ok);
	if (!ok)
	{
		qDebug() << "Could not parse the port value, using 8001";
		port = 8001;
	}
	MasterNode master;
	master.listen(QHostAddress::AnyIPv4, port);
	app.exec();
	return 1;
}
Exemple #6
0
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	QCoreApplication::setApplicationName("empire-gui");

	// Configure parser for command line arguments
	QCommandLineParser parser;
	parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
	parser.addHelpOption();
	QCommandLineOption modeOption("obs", "Start the client as observer.");
	parser.addOption(modeOption);
	QCommandLineOption addressOption("saddr", "Server address.", "port", "localhost");
	parser.addOption(addressOption);
	QCommandLineOption portOption("sport", "Server port.", "port", "0");
	parser.addOption(portOption);

	// Get arguments values
	parser.process(a);

	MainWindow w;

	// Process arguments
	QStringList args = parser.positionalArguments();
	QString address = parser.value("saddr");
	int port = parser.value("sport").toInt();
	w.initialize(address, port, parser.isSet(modeOption));
	w.show();

	return a.exec();
}
Exemple #7
0
int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);

    // some command line arguments parsing stuff
    QCoreApplication::setApplicationName("ujea");
    QCoreApplication::setApplicationVersion("1.2");

    QString hostname = QHostInfo::localHostName();

    QCommandLineParser parser;
    parser.setApplicationDescription("Universal job execution agent using AMQP queue");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addOption(QCommandLineOption("aliveInterval", "Interval in ms between alive messages (1000).", "aliveInterval", "1000"));
    parser.addOption(QCommandLineOption("aliveTTL", "TTL in queue for alive messages (1500).", "aliveTTL", "1500"));
    parser.addOption(QCommandLineOption("queueCmd", "Commands queue name ("+hostname+"_cmd).", "queueCmd", hostname+"_cmd"));
    parser.addOption(QCommandLineOption("queueRpl", "Replays queue name ("+hostname+"_rpl).", "queueRpl", hostname+"_rpl"));
    parser.addOption(QCommandLineOption("execRegex", "Regex for permited commands. (none)", "execRegex", ""));
    parser.addPositionalArgument("url", QCoreApplication::translate("main", "AMQP url"));
    parser.process(app);

    const QStringList args = parser.positionalArguments();

    // we need to have 1 argument and optional named arguments
    if (args.count() != 1) parser.showHelp(-1);

    // create and execure worker
    JobsExecuter qw{QUrl(args.value(0)), parser.value("queueCmd"), parser.value("queueRpl"),
                    parser.value("aliveInterval").toInt(), parser.value("aliveTTL").toInt(),
                    parser.value("execRegex")};

    return app.exec();
}
Exemple #8
0
QT_USE_NAMESPACE

int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);

    QCoreApplication::setApplicationName(QStringLiteral("qtdiag"));
    QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
    QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
    QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));

    QCommandLineParser commandLineParser;
    const QCommandLineOption noGlOption(QStringLiteral("no-gl"), QStringLiteral("Do not output GL information"));
    const QCommandLineOption glExtensionOption(QStringLiteral("gl-extensions"), QStringLiteral("List GL extensions"));
    const QCommandLineOption fontOption(QStringLiteral("fonts"), QStringLiteral("Output list of fonts"));
    commandLineParser.setApplicationDescription(QStringLiteral("Prints diagnostic output about the Qt library."));
    commandLineParser.addOption(noGlOption);
    commandLineParser.addOption(glExtensionOption);
    commandLineParser.addOption(fontOption);
    commandLineParser.addHelpOption();
    commandLineParser.process(app);
    unsigned flags = commandLineParser.isSet(noGlOption) ? 0u : unsigned(QtDiagGl);
    if (commandLineParser.isSet(glExtensionOption))
        flags |= QtDiagGlExtensions;
    if (commandLineParser.isSet(fontOption))
        flags |= QtDiagFonts;

    std::wcout << qtDiag(flags).toStdWString();
    return 0;
}
Exemple #9
0
int main(int argc, char *argv[])
{
    LXQt::Application a(argc, argv);
    a.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    QCommandLineParser parser;
    parser.setApplicationDescription(QStringLiteral("LXQt OpenSSH Askpass"));
    const QString VERINFO = QStringLiteral(LXQT_ASKPASS_VERSION
                                           "\nliblxqt   " LXQT_VERSION
                                           "\nQt        " QT_VERSION_STR);
    a.setApplicationVersion(VERINFO);
    parser.addVersionOption();
    parser.addHelpOption();
    parser.process(a);

    // TODO/FIXME: maybe a better algorithm?
    QString prompt;
    if (a.arguments().count() < 2)
        prompt = QObject::tr("unknown request");
    else
        prompt = a.arguments().at(a.arguments().count()-1);

    MainWindow w(prompt);
    w.show();

    return a.exec();
}
Exemple #10
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    app.setApplicationName(QStringLiteral("kiconfinder"));
    app.setApplicationVersion(KICONTHEMES_VERSION_STRING);
    QCommandLineParser parser;
    parser.setApplicationDescription(app.translate("main", "Finds an icon based on its name"));
    parser.addPositionalArgument(QStringLiteral("iconname"), app.translate("main", "The icon name to look for"));
    parser.addHelpOption();

    parser.process(app);
    if(parser.positionalArguments().isEmpty())
        parser.showHelp();

    Q_FOREACH(const QString& iconName, parser.positionalArguments()) {
        const QString icon = KIconLoader::global()->iconPath(iconName, KIconLoader::Desktop /*TODO configurable*/, true);
        if ( !icon.isEmpty() ) {
            printf("%s\n", icon.toLocal8Bit().constData());
        } else {
            return 1; // error
        }
    }

    return 0;
}
Exemple #11
0
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(mdi);

    QApplication app(argc, argv);

    QCoreApplication::setApplicationName("lua_debug_ui");
    QCoreApplication::setOrganizationName("huangzhe");
    QCoreApplication::setApplicationVersion(QT_VERSION_STR);
    QCommandLineParser parser;
    parser.setApplicationDescription("lua_debug_ui");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("file", "The file to open.");
    parser.process(app);

    MainWindow mainWin;
    if(false == mainWin.checkAndOpenFile( parser.positionalArguments().at(0), parser.positionalArguments().length() > 0))
    {
        return 0;
    }

    mainWin.show();
    foreach (const QString &fileName, parser.positionalArguments())
        mainWin.openFile(fileName);
    return app.exec();
}
Exemple #12
0
    void Arguments::parse()
    {
        QCommandLineParser parser;
        parser.setApplicationDescription("Unit tests");
        parser.addHelpOption();

        static const QString rootOptionName = "r";
        static const QString dbOptionName   = "d";
        parser.addOptions({
            {{rootOptionName, "test_root"}, "Set tests root path. Have to be specified"   , "root"},
            {{dbOptionName  , "db_path"  }, "Set main database path. Have to be specified", "db"  },
            {"gtest_shuffle", "Shuffle tests"},
        });

        if (!parser.parse(qApp->arguments()))
            parser.showHelp();

        auto tmpRootPath = parser.value(rootOptionName);
        auto tmpDbPath   = parser.value(dbOptionName);

        if (tmpRootPath.isEmpty() || tmpDbPath.isEmpty())
            parser.showHelp();

        m_rootPath = tmpRootPath;
        m_dbPath   = tmpDbPath;
    }
LxQtPanelApplication::LxQtPanelApplication(int& argc, char** argv)
    : LxQt::Application(argc, argv, true)
{
    QCoreApplication::setApplicationName(QStringLiteral("lxqt-panel"));
    QCoreApplication::setApplicationVersion(LXQT_VERSION);

    QCommandLineParser parser;
    parser.setApplicationDescription(QStringLiteral("LXQt panel"));
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption configFileOption(QStringList()
            << QStringLiteral("c") << QStringLiteral("config") << QStringLiteral("configfile"),
            QCoreApplication::translate("main", "Use alternate configuration file."),
            QCoreApplication::translate("main", "Configuration file"));
    parser.addOption(configFileOption);

    parser.process(*this);

    const QString configFile = parser.value(configFileOption);

    if (configFile.isEmpty())
        mSettings = new LxQt::Settings(QStringLiteral("panel"), this);
    else
        mSettings = new LxQt::Settings(configFile, QSettings::IniFormat, this);

    // This is a workaround for Qt 5 bug #40681.
    Q_FOREACH(QScreen* screen, screens())
    {
        connect(screen, &QScreen::destroyed, this, &LxQtPanelApplication::screenDestroyed);
    }
Exemple #14
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    KAboutData aboutData("kdeconnect.app", i18n("Awesome App"), "1.0", i18n("KDE Connect App"), KAboutLicense::GPL, i18n("(c) 2015, Aleix Pol Gonzalez"));
    aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), "*****@*****.**");
    KAboutData::setApplicationData(aboutData);

    {
        QCommandLineParser parser;
        aboutData.setupCommandLine(&parser);
        parser.addVersionOption();
        parser.addHelpOption();
        parser.process(app);
        aboutData.processCommandLine(&parser);
    }
 
    QQmlApplicationEngine engine;

    KDeclarative::KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(&engine);
    kdeclarative.setupBindings();

    engine.load(QUrl("qrc:/qml/main.qml"));

    return app.exec();
}
Exemple #15
0
int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    const QString description = QStringLiteral("Converts desktop files to json");
    const char version[] = "1.0";

    app.setApplicationVersion(version);

    const static QString _i = QStringLiteral("input");
    const static QString _o = QStringLiteral("output");
    const static QString _n = QStringLiteral("name");

    QCommandLineOption input = QCommandLineOption(QStringList() << QStringLiteral("i") << _i,
                                        QStringLiteral("Read input from file"), _n);
    QCommandLineOption output = QCommandLineOption(QStringList() << QStringLiteral("o") << _o,
                                        QStringLiteral("Write output to file"), _n);

    QCommandLineParser parser;
    parser.addVersionOption();
    parser.addHelpOption(description);
    parser.addOption(input);
    parser.addOption(output);

    KConfigToJson dtj(&parser, input, output);

    parser.process(app);
    return dtj.runMain();
}
Exemple #16
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    KAboutData about = newBrainDumpAboutData();
    KAboutData::setApplicationData(about);

    QCommandLineParser parser;

    parser.addVersionOption();
    parser.addHelpOption();

    parser.process(app);

    about.setupCommandLine(&parser);
    about.processCommandLine(&parser);

    KIconLoader::global()->addAppDir("calligra");
    KoGlobal::initialize();

    RootSection* doc = new RootSection;

    MainWindow* window = new MainWindow(doc);
    window->setVisible(true);

    app.exec();

    // Ensure the root section is saved
    doc->sectionsIO()->save();

    delete doc;
    app.exit(0);
}
Exemple #17
0
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QCommandLineParser parser;
    parser.addVersionOption();
    parser.addHelpOption();
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("demopoints_single"), i18n("Add built-in demo points as single markers")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("demopoints_group"),  i18n("Add built-in demo points as groupable markers")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("single"),            i18n("Do not group the displayed images")));
    parser.addPositionalArgument(QString::fromLatin1("images"), i18n("List of images"), QString::fromLatin1("[images...]"));
    parser.process(app);

    // get the list of images to load on startup:
    QList<QUrl> imagesList;

    foreach(const QString& file, parser.positionalArguments())
    {
        const QUrl argUrl = QUrl::fromLocalFile(file);
        qDebug() << argUrl;
        imagesList << argUrl;
    }

    MainWindow* const myMainWindow = new MainWindow(&parser);
    myMainWindow->show();
    myMainWindow->slotScheduleImagesForLoading(imagesList);

    return app.exec();
}
//! Bereitet die Eingabeparameter vor
void createInputCommands(QCommandLineParser &cmdParser) {
  //! Befehle
  QCommandLineOption inputPath("i", "Path for input", "...");
  QCommandLineOption outputPath("o", "Path for output", "...");
  QCommandLineOption generateType("g", "Generating type", "[htmlbasic]");
  QCommandLineOption chartTitle("t", "Title for the chart", "...");
  QCommandLineOption minValueX("x", "Maximumvalue for the chart on the X-Axis", "...");
  QCommandLineOption minValueY("y", "Maximumvalue for the chart on the Y-Axis", "...");

  cmdParser.setApplicationDescription("Description");
  cmdParser.addHelpOption();
  cmdParser.addPositionalArgument("useLabel",
                                  "Use the label form json as label for the graph");
  cmdParser.addPositionalArgument("useScrolling", "Uses Scrolling with Highstock");
  cmdParser.addPositionalArgument("useInlineJS",
                                  "Uses JQuery and HighChart without seperate File");
  cmdParser.addPositionalArgument("useNavigator", "Adds a navigator to the chart");

  //! Optionen hinzufügen
  cmdParser.addOption(inputPath);
  cmdParser.addOption(outputPath);
  cmdParser.addOption(generateType);
  cmdParser.addOption(chartTitle);
  cmdParser.addOption(minValueX);
  cmdParser.addOption(minValueY);
}
Exemple #19
0
int main(int argc, char *argv[]) {

    QApplication app(argc, argv);
    qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
    QCoreApplication::setApplicationName("Focus");
    QCoreApplication::setOrganizationName("C-CINA");
    QCoreApplication::setOrganizationDomain("c-cina.org");

    QCommandLineParser parser;
    parser.setApplicationDescription("Focus Software Suite: Main Graphical User Interface & Project Manager");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addPositionalArgument("project_dir", "Path of the focus Project to be opened.");
    parser.process(app);
    
    UserPreferences().loadAllFontSettings();

    if (!parser.positionalArguments().isEmpty()) {
        loadMainWindow(parser.positionalArguments().first());
    } else {
        if(!openProject()) {
            QApplication::quit();
            return 0;
        }
    }

    return app.exec();
}
Exemple #20
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
#if 0
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    qInstallMessageHandler(myMessageHandler);
#else
    qInstallMsgHandler(myMessageHandler);
#endif
#endif
    //qDebug("hello");
    //qDebug() << "world";
    QCoreApplication::setApplicationVersion(QT_VERSION_STR);

    QCommandLineParser parser;
    parser.addHelpOption();
    parser.addVersionOption();

    parser.process(app);

    MainWindow mainWindow;
    const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mainWindow);
    mainWindow.resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
    //mainWindow.show();
    mainWindow.showMaximized();

    QFile file("qss/stylesheet.qss");  
    if (!file.open(QFile::ReadOnly)) {
        QMessageBox::warning(NULL, "Codecs",
                QString("Cannot read file %1").arg(file.errorString()));
    }
    app.setStyleSheet(file.readAll()); 
    file.close();
    return app.exec();
}
Exemple #21
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setApplicationName(TARGET);
    a.setApplicationVersion("1");
#ifdef __linux__
    a.setWindowIcon(QIcon(":MoleGraph.png"));
#endif

    QCommandLineParser parser;
    parser.setApplicationDescription("Test helper");
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption openOption(QStringList() << "o" << "open-file",
                QCoreApplication::translate("main", "Open file."), QCoreApplication::translate("main", "directory"));
    parser.addOption(openOption);

    QCommandLineOption withoutValuesOption(QStringList() << "w" << "without-values",
                QCoreApplication::translate("main", "Modifier for opening file without values (just measurement template)."));
    parser.addOption(withoutValuesOption);

    parser.addPositionalArgument("file", "file to open");

    parser.process(a);

    QString fileName = parser.value(openOption);
    const QStringList arguments = parser.positionalArguments();
    if (arguments.size() > 0)
        fileName = arguments[0];
    MainWindow w(a, fileName, parser.isSet(withoutValuesOption));
    w.show();

	return a.exec();
}
Exemple #22
0
int main(int argc, char** argv)
{
    if( loadSettingsOk(argc, argv) )
    {
        // If -l option is provided, settings are loaded and app is closed.
        QCoreApplication app(argc, argv);
        LoadSettings load;
        return app.exec();
    }

    LXQt::SingleApplication app(argc, argv);

    // Command line options
    QCommandLineParser parser;
    QCommandLineOption loadOption(QStringList() << "l" << "loadlast",
            app.tr("Load last settings."));
    parser.addOption(loadOption);
    QCommandLineOption helpOption = parser.addHelpOption();
    parser.addOption(loadOption);
    parser.addOption(helpOption);

    //parser.process(app);
    //bool loadLastSettings = parser.isSet(loadOption);

    MonitorSettingsDialog dlg;
    app.setActivationWindow(&dlg);
    dlg.setWindowIcon(QIcon::fromTheme("preferences-desktop-display"));
    dlg.show();

    return app.exec();

}
Exemple #23
0
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QCoreApplication::setApplicationName("armadill");
    QCoreApplication::setApplicationVersion("0.1");

    QCommandLineParser parser;

    parser.setApplicationDescription("armadill- super secure IM");

    parser.addPositionalArgument("server", "Server ip to connect to");
    parser.addPositionalArgument("port", "port of that server");
    parser.addHelpOption();

    QCommandLineOption test(QStringList() << "t" << "test", "Run tests");
    parser.addOption(test);

    parser.process(a);

    if(parser.isSet(test))
    {
        UTest test;
        return test.makeTests(argc, argv);
    }

    //parse things, run test if test
	QTextStream out(stdout);
    ClientConsole n(parser.positionalArguments(), out, &a);
    QMetaObject::invokeMethod(&n, "init", Qt::QueuedConnection);

    return a.exec();
}
Exemple #24
0
int main(int argc, char **argv) {
	QApplication app(argc, argv);
	QApplication::setApplicationName("ViewDown");
	QApplication::setApplicationVersion("1.0");
	app.setWindowIcon(QIcon("qrc:///viewdown.ico"));

	QCommandLineParser parser;
	parser.setApplicationDescription("Markdown viewer, reloading on changes.");
	parser.addPositionalArgument("file", "markdown file to view and reload on change.");
	parser.addPositionalArgument("watch", "files or directories to watch as trigger for reload.", "[watch...]");
	const QCommandLineOption styleOption("s", "css file to use as stylesheet.", "css");
	parser.addOption(styleOption);
	parser.addHelpOption();
	parser.addVersionOption();

	parser.process(app);

	QUrl styleUrl;
	if (parser.isSet(styleOption)) {
		const QString path = parser.value(styleOption);
		QFileInfo info = QFileInfo(path);
		if (info.exists())
		        styleUrl = QUrl::fromLocalFile(info.canonicalFilePath());
		else
			qWarning("No such file: %s", qPrintable(path));
	}
	if (styleUrl.isEmpty())
		styleUrl = QUrl("qrc:///github.css");

	MainWindow *browser = new MainWindow(parser.positionalArguments(), styleUrl);
	browser->show();
	return app.exec();
}
Exemple #25
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
    app.setAttribute(Qt::AA_EnableHighDpiScaling);
    KLocalizedString::setApplicationDomain("contactprintthemeeditor");
    KAboutData aboutData(QStringLiteral("contactprintthemeeditor"),
                         i18n("Contact Print Theme Editor"),
                         QStringLiteral(GRANTLEEEDITOR_VERSION),
                         i18n("Contact Print Theme Editor"),
                         KAboutLicense::GPL_V2,
                         i18n("Copyright © 2015-2016 contactprintthemeeditor authors"));
    aboutData.addAuthor(i18n("Laurent Montel"), i18n("Maintainer"), QStringLiteral("*****@*****.**"));
    QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kaddressbook")));
    aboutData.setOrganizationDomain(QByteArray("kde.org"));
    aboutData.setProductName(QByteArray("contactprintthemeeditor"));

    KAboutData::setApplicationData(aboutData);
    KCrash::initialize();

    QCommandLineParser parser;
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);

    parser.process(app);
    aboutData.processCommandLine(&parser);

    KDBusService service;

    ThemeEditorMainWindow *mw = new ThemeEditorMainWindow;
    mw->show();
    const int ret = app.exec();
    return ret;
}
Exemple #26
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    KLocalizedString::setApplicationDomain("fatcrm");

    KAboutData aboutData(QStringLiteral("fatcrm"), i18n("FatCRM"),
                     version, i18n(description),
                     KAboutLicense::GPL_V2, i18n("(C) 2010-2018 KDAB"),
                     QString(), QStringLiteral("*****@*****.**"));

    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
    QCommandLineOption noOverlayOption("nooverlay", i18n("Do not display the overlay during initial data loading"));
    parser.addOption(noOverlayOption);
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);

    QMimeDatabase db;
    if (!db.mimeTypeForName("application/x-vnd.kdab.crm.opportunity").isValid()) {
        KMessageBox::error(nullptr, i18n("Mimetype application/x-vnd.kdab.crm.opportunity not found, please check your FatCRM installation"));
        return 1;
    }

    KDBusService service(KDBusService::Multiple);

    auto *window = new MainWindow(!parser.isSet(noOverlayOption));
    window->setAttribute(Qt::WA_DeleteOnClose);
    window->show();
    return app.exec();
}
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    app.setApplicationName(QLatin1String("ThumbNailer"));
    app.setOrganizationDomain(QLatin1String("kde.org"));
    QCommandLineParser parser;
    parser.setApplicationDescription(app.translate("main", "ThreadWeaver ThumbNailer Example"));
    parser.addHelpOption();
    parser.addPositionalArgument(QLatin1String("mode"), QLatin1String("Benchmark or demo mode"));
    parser.process(app);
    const QStringList positionals = parser.positionalArguments();
    const QString mode = positionals.isEmpty() ? QLatin1String("demo") : positionals[0];
    if (mode == QLatin1String("benchmark")) {
        Benchmark benchmark;
        const QStringList arguments = app.arguments().mid(1); // remove mode selection
        return QTest::qExec(&benchmark, arguments);
    } else if (mode == QLatin1String("demo")){
        // demo mode
        MainWindow mainWindow;
        mainWindow.show();
        return app.exec();
    } else {
        wcerr << "Unknown mode " << mode.toStdWString() << endl << endl;
        parser.showHelp();
        Q_UNREACHABLE();
    }
    return 0;
}
Exemple #28
0
int main(int argc, char **argv)
{
  QApplication app(argc, argv);

  KLocalizedString::setApplicationDomain("polka");

  KAboutData about( QStringLiteral("polka"), i18n("Polka"), version,
    i18n("The humane address book for the cloud"), KAboutLicense::GPL,
    i18n("(c) 2009-2015 Cornelius Schumacher"), QStringLiteral(),
    QStringLiteral("http://cornelius-schumacher.de/polka/"),
    QStringLiteral("*****@*****.**"));

  about.addAuthor(i18n("Cornelius Schumacher"), i18n("Creator"),
    QStringLiteral("*****@*****.**"));

  KAboutData::setApplicationData(about);

  QCommandLineParser parser;
  parser.addHelpOption();
  parser.addVersionOption();
  about.setupCommandLine(&parser);
  parser.process(app);
  about.processCommandLine(&parser);

  MainWindow *widget = new MainWindow;
  widget->show();

  return app.exec();
}
Exemple #29
0
void parseCommandLine(QCoreApplication &app, CmdLineOptions *opts)
{
    QCommandLineParser parser;

    parser.setApplicationDescription("remove db key at specified path");
    parser.addHelpOption();
    parser.addVersionOption();

    parser.addPositionalArgument("key", QCoreApplication::translate("main", "key"));

    QCommandLineOption debugOption(QStringList() << "d" << "debug",
                                   QCoreApplication::translate("main", "enable debug/verbose logging"));
    parser.addOption(debugOption);

    parser.process(app);

    opts->debuggingEnabled = parser.isSet(debugOption);

    const QStringList posArgs = parser.positionalArguments();
    if (posArgs.size() < 1)
    {
        qCritical("invalid arguments");
        exit(1);
    }

    opts->key = posArgs.at(0);

    DbdLogging::logger()->debugMode =  opts->debuggingEnabled;

    qDebug() << "debugging enabled:" << opts->debuggingEnabled;
    qDebug() << "key:" << opts->key;
}
Exemple #30
0
int main(int argc, char *argv[])
{
	QCoreApplication app(argc, argv);
	QCoreApplication::setApplicationName("MyFib");
	QCoreApplication::setApplicationVersion("1.1");
	
	QCommandLineParser clap;
	clap.setApplicationDescription("Calculates fibonacci numbers, slowly!");
	clap.addHelpOption();
	clap.addVersionOption();

	const int def_n = 42;

	QCommandLineOption numopt(QStringList() << "n", "number", "Number", "N");
	numopt.setDefaultValue(QString::number(def_n, 10));
	clap.addOption(numopt);
	clap.process(app);

	bool n_ok = true;
	int n = clap.value(numopt).toInt(&n_ok);
	MyFibCalc* calc = new MyFibCalc(&app, n_ok?n:def_n);

	QObject::connect(calc, SIGNAL(done()), &app, SLOT(quit()));

	QTimer::singleShot(0, calc, SLOT(calculate()));

	return app.exec();
}