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


C++ KCmdLineOptions::add方法代码示例

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


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

示例1: main

int main(int argc, char **argv)
{
    KAboutData about("khotnewstuff", 0, ki18n("KHotNewStuff"), "0.4");
    about.setProgramIconName("get-hot-new-stuff");
    KCmdLineArgs *args;

    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions op;
    op.add("+filename", ki18n("Name of .knsrc file to use"));
    op.add("+filename", ki18n("Name of file to upload"));
    KCmdLineArgs::addCmdLineOptions(op);
    args = KCmdLineArgs::parsedArgs();

    KApplication i;
    
    if (args->count() > 0) {
        KNS3::UploadDialog dialog(args->arg(0));
        if (args->count() > 1) {
            dialog.setUploadFile(KUrl(args->arg(1)));
        }
        dialog.exec();
    }
    else
    {
        args->usage();
        return -1;
    }
    return 0;
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:30,代码来源:khotnewstuff_upload.cpp

示例2: main

int main(int argc, char** argv)
{
	qsrand(time(0));
	KAboutData about("palapeli", 0, ki18nc("The application's name", "Palapeli"), "2.0", ki18n("KDE Jigsaw Puzzle Game"), KAboutData::License_GPL, ki18n("Copyright 2009, 2010, Stefan Majewsky"));
	about.addAuthor(ki18n("Stefan Majewsky"), KLocalizedString(), "[email protected]", "http://majewsky.wordpress.com");
	about.addCredit (ki18n ("Johannes Loehnert"),
			 ki18n ("The option to preview the completed puzzle"),
			 "[email protected]");
	about.setHomepage("https://www.kde.org/applications/games/palapeli/");
	KCmdLineArgs::init(argc, argv, &about);

	KCmdLineOptions options;
	options.add("+puzzlefile", ki18n("Path to puzzle file (will be opened if -i is not given)"));
	options.add("i").add("import", ki18n("Import the given puzzle file into the local collection (does nothing if no puzzle file is given)"));
	options.add("", ki18n("If the -i/--import option is specified, the main window will not be shown after importing the given puzzle."));
	KCmdLineArgs::addCmdLineOptions(options);

	KApplication app;

	KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
	//NOTE: Syntax errors are reported on stderr, while file errors are presented to the user.
	if (args->isSet("import"))
		//perform import request
		new Palapeli::ImportHelper(args);
	else
		//no import request, show main window
		(new Palapeli::MainWindow(args))->show();
	return app.exec();
}
开发者ID:KDE,项目名称:palapeli,代码行数:29,代码来源:main.cpp

示例3: main

int main(int argc, char **argv)
{
    KCmdLineArgs::init(argc, argv, &aboutData);

    KCmdLineOptions options;
    options.add("embed <winid>", ki18n("Makes the dialog transient for an X app specified by winid"));
    options.add("+[URL]", ki18n("URL to install"));
    KCmdLineArgs::addCmdLineOptions(options);

    QSet<KUrl>   urls;
    KCmdLineArgs *args(KCmdLineArgs::parsedArgs());

    for(int i=0; i < args->count(); i++)
        urls.insert(args->url(i));

    if(urls.count())
    {

        KApplication    app;
        QString         opt(args->getOption("embed"));
        KFI::CInstaller inst(createParent(opt.size() ? opt.toInt(0, 16) : 0));

        return inst.install(urls);
    }

    return -1;
}
开发者ID:KDE,项目名称:kde-workspace,代码行数:27,代码来源:Installer.cpp

示例4: main

int main(int argc, char ** argv)
{
    KCmdLineOptions options;
    options.add("+URL1", ki18n("The first URL to play"));
    options.add("+URL2", ki18n("The second URL to play"));

    KAboutData about("crossfade", 0, ki18n("Phonon Crossfade Example"),
            "1.0", KLocalizedString(),
            KAboutData::License_LGPL);
    about.addAuthor(ki18n("Matthias Kretz"), KLocalizedString(), "[email protected]");
    KCmdLineArgs::init(argc, argv, &about);
    KCmdLineArgs::addCmdLineOptions(options);
    KApplication app;
    KUrl url1;
    KUrl url2;
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    if (args->count() == 2)
    {
        url1 = args->url(0);
        url2 = args->url(1);
        if (url1.isValid() && url2.isValid())
        {
            Crossfader xfader(url1, url2);
            return app.exec();
        }
    }
    return 1;
}
开发者ID:KDE,项目名称:kdeexamples,代码行数:28,代码来源:crossfade.cpp

示例5: about

int
main(int argc, char *argv[])
{
    KAboutData about("kapptest", 0, ki18n("kapptest"), "version");
    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("t");
    options.add("type <name>", ki18n("The type of shutdown to emulate: Default, None, Reboot, Halt or Logout"), "None");
    KCmdLineArgs::addCmdLineOptions(options);

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    KApplication a;
    KIconLoader::global()->addAppDir("ksmserver");
    KSMShutdownFeedback::start();

    QString sdtypeOption = args->getOption("type").toLower();

    KWorkSpace::ShutdownType sdtype = KWorkSpace::ShutdownTypeDefault;
    if (sdtypeOption == "reboot") {
        sdtype = KWorkSpace::ShutdownTypeReboot;
    } else if (sdtypeOption == "halt") {
        sdtype = KWorkSpace::ShutdownTypeHalt;
    } else if (sdtypeOption == "logout") {
        sdtype = KWorkSpace::ShutdownTypeNone;
    }

    QString bopt;
    (void)KSMShutdownDlg::confirmShutdown( true, true, sdtype, bopt, "default" );
/*   (void)KSMShutdownDlg::confirmShutdown( false, false, sdtype, bopt ); */

    KSMShutdownFeedback::stop();
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:34,代码来源:test.cpp

示例6: main

int main(int argc, char *argv[])
{
  // kdeinit waits for kcminit to finish, but during KDE startup
  // only important kcm's are started very early in the login process,
  // the rest is delayed, so fork and make parent return after the initial phase
  pipe( ready );
  if( fork() != 0 )
  {
      waitForReady();
      return 0;
  }
  close( ready[ 0 ] );

  startup = ( strcmp( argv[ 0 ], "kcminit_startup" ) == 0 ); // started from startkde?
  KAboutData aboutData( "kcminit", "kcminit", ki18n("KCMInit"),
                        "",
                        ki18n("KCMInit - runs startup initialization for Control Modules."));

  KCmdLineArgs::init(argc, argv, &aboutData);

  KCmdLineOptions options;
  options.add("list", ki18n("List modules that are run at startup"));
  options.add("+module", ki18n("Configuration module to run"));
  KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.

  KApplication app;
  QDBusConnection::sessionBus().interface()->registerService( "org.kde.kcminit",
      QDBusConnectionInterface::DontQueueService );
  KLocale::setMainCatalog(0);
  KCMInit kcminit( KCmdLineArgs::parsedArgs());
  return 0;
}
开发者ID:fluxer,项目名称:kde-workspace,代码行数:32,代码来源:main.cpp

示例7: main

int main(int argc, char *argv[])
{
    KAboutData aboutData(
        "gwenview",        /* appname */
        0,                 /* catalogName */
        ki18n("Gwenview"), /* programName */
        GWENVIEW_VERSION); /* version */
    aboutData.setShortDescription(ki18n("An Image Viewer"));
    aboutData.setLicense(KAboutData::License_GPL);
    aboutData.setCopyrightStatement(ki18n("Copyright 2000-2010 Aurélien Gâteau"));
    aboutData.addAuthor(
        ki18n("Aurélien Gâteau"),
        ki18n("Main developer"),
        "[email protected]");

    KCmdLineArgs::init(argc, argv, &aboutData);

    KCmdLineOptions options;
    options.add("f", ki18n("Start in fullscreen mode"));
    options.add("s", ki18n("Start in slideshow mode"));
    options.add("+[file or folder]", ki18n("A starting file or folder"));
    KCmdLineArgs::addCmdLineOptions(options);

    KApplication app;
    Gwenview::ImageFormats::registerPlugins();

    // startHelper must live for the whole live of the application
    StartHelper startHelper;
    if (app.isSessionRestored()) {
        kRestoreMainWindows<Gwenview::MainWindow>();
    } else {
        startHelper.createMainWindow();
    }
    return app.exec();
}
开发者ID:theunbelievablerepo,项目名称:gwenview,代码行数:35,代码来源:main.cpp

示例8: main

int main(int argc, char *argv[])
{
	const KAboutData about(
		"konstruktor", "konstruktor",
		ki18n("Part database updater for Konstruktor"), "0.9.0-beta1",
		ki18n("Updates the part database. Must be called internally by Konstruktor."),
		KAboutData::License_GPL_V3,
		ki18n("(c)2006-2011, Park \"segfault\" Joon-Kyu"));
	
	KCmdLineArgs::init(argc, argv, &about);

	KCmdLineOptions options;
	options.add("+[location]", ki18n("Path to LDraw part library"));
	options.add("rescan", ki18n("Rescan the entire library"));
	KCmdLineArgs::addCmdLineOptions(options);
	
	KApplication app;

	int status;
	try {
		Konstruktor::DBUpdater updater;
		
		status = updater.start();
	} catch (const std::runtime_error &e) {
		QMessageBox::critical(0L, i18n("Error"), QString(e.what()));

		status = -1;
	}
	
	app.exit(status);

	return status;
}
开发者ID:rhabacker,项目名称:Konstruktor,代码行数:33,代码来源:main_dbupdater.cpp

示例9: main

int main(int argc, char **argv)
{
    KAboutData about("soundkonverter", 0, ki18n("soundKonverter"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2005-2012 Daniel Faust"), KLocalizedString(), 0, "[email protected]");
    about.addAuthor( ki18n("Daniel Faust"), KLocalizedString(), "[email protected]" );
    about.addCredit( ki18n("David Vignoni"), ki18n("Nuvola icon theme"), 0, "http://www.icon-king.com" );
    about.addCredit( ki18n("Scott Wheeler"), ki18n("TagLib"), "[email protected]", "http://ktown.kde.org/~wheeler" );
    about.addCredit( ki18n("Marco Nelles"), ki18n("Audex"), 0, "http://opensource.maniatek.de/audex" );
    about.addCredit( ki18n("Amarok developers"), ki18n("Amarok"), 0, "http://amarok.kde.org" );
    about.addCredit( ki18n("All programmers of audio converters"), ki18n("Backends") );
    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add( "replaygain", ki18n("Open the Replay Gain tool an add all given files") );
    options.add( "rip <device>", ki18n("List all tracks on the cd drive <device>, 'auto' will search for a cd") );
    options.add( "profile <profile>", ki18n("Add all files using the given profile") );
    options.add( "format <format>", ki18n("Add all files using the given format") );
    options.add( "output <directory>", ki18n("Output all files to <directory>") );
    options.add( "invisible", ki18n("Start soundKonverter invisible") );
    options.add( "autostart", ki18n("Start the conversion immediately (enabled when using '--invisible')") );
    options.add( "autoclose", ki18n("Close soundKonverter after all files are converted (enabled when using '--invisible')") );
    options.add( "command <command>", ki18n("Execute <command> after each file has been converted (%i=input file, %o=output file)") );
    options.add( "+[files]", ki18n("Audio file(s) to append to the file list") );
    KCmdLineArgs::addCmdLineOptions(options);

    soundKonverterApp::addCmdLineOptions();
    if( !soundKonverterApp::start() )
    {
        return 0;
    }

    soundKonverterApp app;

    // mainWin has WDestructiveClose flag by default, so it will delete itself.
    return app.exec();
}
开发者ID:cyberbeat,项目名称:soundkonverter,代码行数:35,代码来源:main.cpp

示例10: main

int main( int argc, char *argv[] )
{
    KAboutData about("kooka",				// appName
                     "",				// catalogName
                     ki18n("Kooka"),			// programName
#if VCS_AVAILABLE
                     (VERSION " (" VCS_TYPE " " VCS_REVISION ")"),
#else
                     VERSION,				// version
#endif
                     ki18n(shortDesc),			// shortDescription
                     KAboutData::License_GPL_V2,	// licenseType
                     ki18n(copyright),			// copyrightStatement
                     ki18n(longDesc),			// text
                     "http://techbase.kde.org/Projects/Kooka");

    about.addAuthor(ki18n("Jonathan Marten"), ki18n("Current maintainer, KDE4 port"), "[email protected]");
    about.addAuthor(ki18n("Klaas Freitag"), ki18n("Developer"), "[email protected]");
    about.addCredit(ki18n("Mat Colton"), ki18n("Graphics, web"), "[email protected]");
    about.addCredit(ki18n("Ivan Shvedunov"), ki18n("Original kscan application"), "[email protected]");
    about.addCredit(ki18n("Alex Kempshall"), ki18n("Photocopy facility"), "[email protected]");
    about.addLicenseText(ki18n(addLicense));

    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("d <device>", ki18n("The SANE device specification (e.g. 'umax:/dev/sg0')"));
    options.add("g", ki18n("Gallery mode - do not connect to scanner"));
    KCmdLineArgs::addCmdLineOptions(options);		// Add my own options

    KApplication app;
    KGlobal::locale()->insertCatalog("libkscan");

    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
    QString devToUse = args->getOption("d");
    if (args->isSet("g"))
    {
        devToUse = "gallery";
    }
    kDebug() << "DevToUse is" << devToUse;

// TODO: not sure what this did
//    if (args->count()==1)
//    {
//        args->usage();
//        // exit(-1);
//    }

    // TODO: try ScanGlobal::init(), if that fails no point in carrying on
    // so show an error box and give up (or can we carry on and run in
    // gallery mode only?)

    Kooka *kooka = new Kooka(devToUse.toLocal8Bit());
    kooka->show();
    app.processEvents();
    kooka->startup();
    args->clear();

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

示例11: main

int main(int argc, char **argv)
{
    KAboutData about("kglobalsettingsclient", 0, ki18n("kglobalsettingsclient"), "version");
    KCmdLineArgs::init(argc, argv, &about);

    KCmdLineOptions options;
    options.add("p", ki18n("emit paletteChanged()"));
    options.add("f", ki18n("emit fontChanged()"));
    options.add("ps", ki18n("emit settingsChanged(SETTINGS_PATH)"));

    KCmdLineArgs::addCmdLineOptions( options );
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    KComponentData componentData(&about); // for KConfig
    QApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv(), false );

    if (args->isSet("p")) {
        kDebug() << "emitChange(PaletteChanged)";
        KGlobalSettings::self()->emitChange(KGlobalSettings::PaletteChanged);
	return 0;
    } else if (args->isSet("f")) {
        kDebug() << "emitChange(FontChanged)";
        KGlobalSettings::self()->emitChange(KGlobalSettings::FontChanged);
        return 0;
    } else if (args->isSet("ps")) {
        kDebug() << "emitChange(SettingsChanged)";
        KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_PATHS);
        return 0;
    }

    KCmdLineArgs::usage("No action specified");
    return 1; //notreached
}
开发者ID:fluxer,项目名称:kdelibs,代码行数:33,代码来源:kglobalsettingsclient.cpp

示例12: main

int main ( int argc, char *argv[] )
{

  KAboutData aboutData( "aku", 0, ki18n("aKu"),
      "SVN", ki18n("The RAR application for KDE4"), KAboutData::License_GPL_V3,
      ki18n("Copyright (c) 2008"));
   
  aboutData.addAuthor(ki18n("Alessandro Diaferia aka \"The Speedy Coder\""), ki18n("Main Developer"), "[email protected]");
  aboutData.addAuthor(ki18n("Francesco Grieco aka \"The Japanese GUI stylist\""), ki18n("Developer"), "[email protected]");
  // chiamata per disattivare il report dei bugs a kde4
  aboutData.setCustomAuthorText(ki18n(0), ki18n(0));
  KCmdLineArgs::init(argc, argv, &aboutData);
  KCmdLineOptions options;
  options.add("+[archive]", ki18n("Makes aKu open the archive specified"));
  options.add("extracthere", ki18n("Extracts all files in the archive path")); // FIXME: extracthere <destination>
  options.add("extractto", ki18n("Extracts all files in a selected path"));
  KCmdLineArgs::addCmdLineOptions( options );

  KApplication app;
  QString loIcon = KIconLoader().iconPath("aku",-KIconLoader::SizeEnormous );
  QApplication::setWindowIcon(KIcon(loIcon));
  //QApplication::setWindowIcon( KIcon( "utilities-file-archiver" ) ); ///TEMP ICON
  QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
  MainWindow * mw = new MainWindow();
  mw->show();
 // KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

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

示例13: main

int main(int argc, char **argv)
{
    KAboutData aboutData("kstartperf", 0, ki18n("KStartPerf"),
	    "1.0", ki18n("Measures start up time of a KDE application"),
	    KAboutData::License_Artistic,
	    ki18n("Copyright (c) 2000 Geert Jansen and libkmapnotify authors"));
    aboutData.addAuthor(ki18n("Geert Jansen"), ki18n("Maintainer"),
	    "[email protected]", "http://www.stack.nl/~geertj/");

    KCmdLineArgs::init(argc, argv, &aboutData);

    KCmdLineOptions options;
    options.add("+command", ki18n("Specifies the command to run"));
    options.add("!+[args]", ki18n("Arguments to 'command'"));
    KCmdLineArgs::addCmdLineOptions(options);
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    KComponentData componentData( &aboutData );
    QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );

    // Check arguments

    if (args->count() == 0)
    {
	fprintf(stderr, "No command specified!\n");
	fprintf(stderr, "usage: kstartperf command [arguments]\n");
	exit(1);
    }

    // Build command

    char cmd[1024];
    snprintf(cmd, sizeof(cmd), "LD_PRELOAD=%s %s", 
             qPrintable( libkstartperf() ), qPrintable(args->arg(0)));
    for (int i=1; i<args->count(); i++)
    {
	strcat(cmd, " ");
	strcat(cmd, args->arg(i).toLocal8Bit());
    }

    // Put the current time in the environment variable `KSTARTPERF'

    struct timeval tv;
    if (gettimeofday(&tv, 0L) != 0)
    {
	perror("gettimeofday()");
	exit(1);
    }
    char env[100];
    sprintf(env, "KSTARTPERF=%ld:%ld", tv.tv_sec, tv.tv_usec);
    putenv(env);

    // And exec() the command

    execl("/bin/sh", "sh", "-c", cmd, (void *)0);

    perror("execl()");
    exit(1);
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:59,代码来源:kstartperf.cpp

示例14: setupCommandOptions

void InfoCommand::setupCommandOptions(KCmdLineOptions &options)
{
  AbstractCommand::setupCommandOptions(options);

  options.add("+[options]", ki18nc("@info:shell", "Options for command"));
  options.add("+collection|item", ki18nc("@info:shell", "The collection or item"));
  options.add(":", ki18nc("@info:shell", "Options for command:"));
  options.add("c").add("collection", ki18nc("@info:shell", "Assume that a collection is specified"));
  options.add("i").add("item", ki18nc("@info:shell", "Assume that an item is specified"));
}
开发者ID:bkandiyal,项目名称:akonadiclient-demo,代码行数:10,代码来源:infocommand.cpp

示例15: setupCommandOptions

void ExportCommand::setupCommandOptions(KCmdLineOptions& options)
{
    AbstractCommand::setupCommandOptions(options);

    addOptionsOption(options);
    options.add("+collection", ki18nc("@info:shell", "The collection to export"));
    options.add("+file", ki18nc("@info:shell", "The file to export to"));
    addOptionSeparator(options);
    addDryRunOption(options);
}
开发者ID:KDE,项目名称:akonadiclient,代码行数:10,代码来源:exportcommand.cpp


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