当前位置: 首页>>代码示例>>C++>>正文


C++ KAboutData::setupCommandLine方法代码示例

本文整理汇总了C++中KAboutData::setupCommandLine方法的典型用法代码示例。如果您正苦于以下问题:C++ KAboutData::setupCommandLine方法的具体用法?C++ KAboutData::setupCommandLine怎么用?C++ KAboutData::setupCommandLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KAboutData的用法示例。


在下文中一共展示了KAboutData::setupCommandLine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

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);
}
开发者ID:UIKit0,项目名称:calligra,代码行数:33,代码来源:main.cpp

示例2: KoApplicationAdaptor

KPlatoWork_Application::KPlatoWork_Application(int argc, char **argv)
    : QApplication(argc, argv),
    m_mainwindow( 0 )
{
    KAboutData *aboutData = KPlatoWork::newAboutData();
    KAboutData::setApplicationData( *aboutData );
    setWindowIcon(QIcon::fromTheme(QStringLiteral("calligraplanwork")));

    aboutData->setupCommandLine(&m_commandLineParser);
    m_commandLineParser.addHelpOption();
    m_commandLineParser.addVersionOption();
    m_commandLineParser.addPositionalArgument(QStringLiteral("[file]"), i18n("File to open"));

    m_commandLineParser.process(*this);

    aboutData->processCommandLine(&m_commandLineParser);

    // Tell the iconloader about share/apps/calligra/icons
/*    KIconLoader::global()->addAppDir("calligra");

    // Initialize all Calligra directories etc.
    KoGlobal::initialize();

    new KoApplicationAdaptor(this);
    QDBusConnection::sessionBus().registerObject("/application", this);*/

    delete aboutData;
}
开发者ID:loveq369,项目名称:calligra,代码行数:28,代码来源:application.cpp

示例3: main

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

    KLocalizedString::setApplicationDomain("okular");

    KAboutData aboutData = okularAboutData();

    app.setApplicationName(aboutData.applicationData().componentName());
    app.setApplicationDisplayName(aboutData.applicationData().displayName());
    app.setApplicationVersion(aboutData.version());
    app.setOrganizationDomain(QStringLiteral("kde.org"));

    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    // The KDE4 version accepted flags such as -unique with a single dash -> preserve compatibility
    parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);

    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("p") << QStringLiteral("page"), i18n("Page of the document to be shown"), QStringLiteral("number")));
    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("presentation"), i18n("Start the document in presentation mode")));
    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("print"), i18n("Start with print dialog")));
    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("unique"), i18n("\"Unique instance\" control")));
    parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("noraise"), i18n("Not raise window")));
    parser.addPositionalArgument(QStringLiteral("urls"), i18n("Documents to open. Specify '-' to read from stdin."));

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

    // see if we are starting with session management
    if (app.isSessionRestored())
    {
        kRestoreMainWindows<Shell>();
    }
    else
    {
        // no session.. just start up normally
        QStringList paths;
        for ( int i = 0; i < parser.positionalArguments().count(); ++i )
            paths << parser.positionalArguments().at(i);
        Okular::Status status = Okular::main(paths, ShellUtils::serializeOptions(parser));
        switch (status)
        {
            case Okular::Error:
                return -1;
            case Okular::AttachedOtherProcess:
                return 0;
            case Okular::Success:
                // Do nothing
                break;
        }
    }

    return app.exec();
}
开发者ID:KDE,项目名称:okular,代码行数:57,代码来源:main.cpp

示例4: QObject

CommandLineParser::CommandLineParser()
    : QObject(),
    m_mainwindow( 0 )
{
    KAboutData *aboutData = KPlatoWork::newAboutData();
    KAboutData::setApplicationData( *aboutData );
    qApp->setWindowIcon(QIcon::fromTheme(QStringLiteral("calligraplanwork")));

    aboutData->setupCommandLine(&m_commandLineParser);
    m_commandLineParser.addHelpOption();
    m_commandLineParser.addVersionOption();
    m_commandLineParser.addPositionalArgument(QStringLiteral("[file]"), i18n("File to open"));

    m_commandLineParser.process(*qApp);

    aboutData->processCommandLine(&m_commandLineParser);

    delete aboutData;
}
开发者ID:KDE,项目名称:calligra,代码行数:19,代码来源:commandlineparser.cpp

示例5: parseCmd

///Setup command line options before passing them to the KUniqueApplication
void Cmd::parseCmd(int argc, char **argv, KAboutData& about)
{
   QApplication app(argc, argv);
   QCommandLineParser parser;
   KAboutData::setApplicationData(about);
   parser.addVersionOption();
   parser.addHelpOption();
   //PORTING SCRIPT: adapt aboutdata variable if necessary
   about.setupCommandLine(&parser);
   parser.process(app);
   about.processCommandLine(&parser);

   parser.addOption(QCommandLineOption(QStringList() << QLatin1String("call"), i18n("Place a call to a given number"                                        ), QLatin1String("number"), QLatin1String("")));
   parser.addOption(QCommandLineOption(QStringList() << QLatin1String("text"), i18n("Send a text to &lt;number&gt;, use --message to set the content, then hangup"), QLatin1String("number"), QLatin1String("")));
   parser.addOption(QCommandLineOption(QStringList() << QLatin1String("message"), i18n("Used in combination with --send-text"                                   ), QLatin1String("content"), QLatin1String("")));

//    QCommandLineParser::parsedArgs();

//    KUniqueApplication::addCmdLineOptions();
}
开发者ID:Elv13,项目名称:sflphone-kde,代码行数:21,代码来源:cmd.cpp


注:本文中的KAboutData::setupCommandLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。