本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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());
}
示例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
}
示例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();
}
示例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);
}
示例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"));
}
示例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);
}